Jump to content

LEFans

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by LEFans

  1. Here is china. It works fine but a little slow.Mozilla firefox. Ha ha, Chinese background.Also look forward to a game demo.
  2. Thank you.Can share a simple and complete example?
  3. Code error. UpdateController ( ) iterations parameters is too large. Thank you. Really like your game: The Last Chapter. Almost done?
  4. Maybe is my program of problem, I try to be checked.Thank you.
  5. Hi, Hello, everyone, and do you have this phenomenon?How to solve? When the controller collide with each other more, the program will become very slow.
  6. If an entity is another entity child objects Please use: TFormPoint(point,src,dst) Conversion position http://www.leadwerks.com/werkspace/files/file/273-lupins-le2-3d-game-engine-starter-kit-for-delphi-and-freepascal/ delphi2C++: #include "engine.h" float AngleDiff(float angle1, float angle2) { angle1 =fmodf(angle1,360); if (angle1<0) angle1=angle1+360; angle2 =fmodf(angle2,360); if (angle2<0) angle2=angle2+360; if (angle1 > angle2) { if(angle1 - angle2 < 360 + angle2 - angle1) return (angle1 - angle2) * -1; else return 360 + angle2 - angle1; } if (angle2 > angle1) { if (angle2 - angle1 < 360 + angle1 - angle2) return angle2 - angle1; else return (360 + angle1 - angle2) * -1; } return 0; } int main(int argc, char** argv) { TPick *pick =new TPick; float move = 0; float strafe = 0; float jump = 0; TVec3 playerpos; TVec3 meshpos; TVec3 campos; int gx = 0; int gy = 0; int mz = 0; float dx = 0; float dy = 0; float camerapitch = 0; float camerayaw = 0; float dist = 0; float framebegin = 0; float frameend = 0; float frame = 0; float rd; float rc; Initialize(); RegisterAbstractPath("F:\\3D\\leadwerks v2.4"); Graphics(800,600); CreateFramework(); TEntity scene = LoadScene("abstract::train.sbx"); TMesh crawler = LoadMesh("abstract::crawler.gmf"); TEntity camera =GetLayerCamera(GetFrameworkLayer(0)); PositionEntity(camera,EntityPosition(crawler)); AmbientLight(Vec3(1.0f, 1.0f, 1.0f)); TController player = CreateController(); EntityType(player,3); EntityType(player,1); SetBodyDamping(player,0.0); SetWorldGravity(Vec3(0,-20,0)); SetBodyMass(player,1); Collisions(2,3,1); gx = GraphicsWidth() / 2; gy = GraphicsHeight() / 2; move = 0.0f; strafe = 0.0f; camerapitch = 0.0f; camerayaw = 0.0f; dist = 2.0f; HideMouse(); MoveMouse(gx, gy); mz = MouseZ(); // Main loop while (!KeyHit(KEY_ESCAPE)) { DebugPhysics(KeyDown(KEY_Q)); if (MouseZ() != mz) { if (mz < MouseZ()) { dist = dist - ((MouseZ() - mz) / 5.0f); if (dist < 1) dist = 1; } else { dist = dist + ((mz - MouseZ()) / 5.0f); if (dist > 5) dist = 5; } mz = MouseZ(); } dx = Curve((MouseX() - gx) / 5.0f, dx, 5.0f / AppSpeed()); dy = Curve((MouseY() - gy) / 5.0f, dy, 5.0f / AppSpeed()); MoveMouse(gx, gy); camerapitch = camerapitch + dy; camerayaw = camerayaw - dx; Min(camerapitch, 90.0f); Max(camerapitch, -90.0f); RotateEntity(camera,Vec3(camerapitch, camerayaw, 0.0f), true); move = (KeyDown(KEY_S) || MouseDown(MOUSE_MIDDLE)) - (KeyDown(KEY_W) || MouseDown(MOUSE_LEFT)); strafe = KeyDown(KEY_A) - KeyDown(KEY_D); if ((move != 0) || (strafe != 0)) { rd = fmodf( EntityRotation(crawler).Y, 360); rc = fmodf(EntityRotation(camera).Y + 180, 360); if (abs(fmodf(rd - rc,360)) <= 12.0f) RotateEntity(crawler,Vec3(0.0f, rc, 0.0f)); else { if (AngleDiff(rc, rd) < 0) TurnEntity( crawler,Vec3(0.0f, 6.0f * AppSpeed(), 0.0f)); else TurnEntity(crawler,Vec3(0.0f, -6.0f * AppSpeed(), 0.0f)); if (move != 0.0f) move = move / 5.0f; if (strafe != 0) strafe = strafe / 5.0f; } } jump = 0.0f; if ((move != 0)) { framebegin=131,frameend=171; } else if ((strafe != 0)) { framebegin=70,frameend=130; } else { framebegin=0,frameend=68; } frame =AppTime()/29.0f; frame =fmodf(frame,frameend-framebegin)+framebegin; Animate(crawler,frame,1.0,0,true); UpdateController(player,EntityRotation (crawler).Y, move * 3.0f, strafe * 2.0f, jump, 40.0f); playerpos = EntityPosition(player); meshpos = EntityPosition(crawler); meshpos.Y = Curve(playerpos.Y, meshpos.Y, 2.0f); meshpos = Vec3(playerpos.X, meshpos.Y, playerpos.Z); PositionEntity(crawler,meshpos); campos = TFormPoint(Vec3(0, 1, 0), crawler,0); PositionEntity (camera,campos); MoveEntity(camera,Vec3(0, 0, -dist)); //HideEntity(player); HideEntity(crawler); if (LinePick(pick,campos, EntityPosition(camera), 0.5f)) PositionEntity(camera,Vec3(pick->X,pick->Y,pick->Z)); MoveEntity(camera,Vec3(0.0f, 0.0f, 0.2f)); // ShowEntity(player); ShowEntity(crawler); UpdateFramework(); RenderFramework(); Flip(); } return Terminate(); }
  7. /*if (!CreateWorld()) { MessageBoxA(0,"Error","Failed to create world.",0); goto exitapp; }*/ CreateFramework();//Include up to the world //TEntity cam= CreateCamera(pivot); //Can so TEntity cam =GetLayerCamera(GetFrameworkLayer(0)); EntityParent(cam,pivot);
  8. http://www.leadwerks.com/werkspace/files/file/273-lupins-le2-3d-game-engine-starter-kit-for-delphi-and-freepascal/ F:Third Person Camera,source code
  9. SetColor(0,0,0,0) DrawRect() SetColor(1,1,1,1) or Fade in,Fade out
  10. Although we here don't celebrate Christmas. But I wish you merry Christmas! 祝福你们圣诞节快乐!
  11. (1)The bullet hit the role, how to judge the pickup to the which part? Such as the head, torso, limbs? (2)Unable to accurately pick up the animation model? Thanks Sorry, I use machine translation, I hope you can understand what I mean.
  12. The forum many attachments are missing.
  13. I use framework, excuse me, how to realize the motion blur? I'm sorry, I use a translator machine.
  14. LEFans

    C-API Manual

    Very need, thank you.
  15. My country as if only through paypal to involve dollars to buy. And this can not be completely sure. I'm sorry, I use the translation machine.
  16. Sorry , I can't speak English.
  17. Will the use of c how to create a framewerk global object? SetGlobalObject("framewerk",???);? Thank.
×
×
  • Create New...