Jump to content

DaDonik

Members
  • Posts

    376
  • Joined

  • Last visited

Posts posted by DaDonik

  1. If it's possible to determine that a body was thrown in the air (just like the user presses a certain key),

    you could set a flag that tells your code that the body was thrown.

    Now you can check if your velocity and rotation is near 0 and just ignore it, if the flag is set.

    You could apply the same for a bouncing object. Just use the collision callback and check if the force is

    sufficient to get the body airborne again. If so, set the flag again.

     

    I do not recommend to check any float value against 0.0f.

    Normally you would define a small value beyond which you assume it's zero.

     

    The way i would do it:

    // Global
    const float cfMinVelocity = 0.01f;
    // For each throwable body
    bool bAirborne = false;
    // Check if the velocity reaches zero
    LE::TVec3 Vel = LE::GetBodyVelocity(TheBody);
    float fVelocity = (float)sqrt(Vel.X*Vel.X + Vel.Y*Vel.Y + Vel.Z*Vel.Z);
    if (fVelocity <= cfMinVelocity)
    {
     if (!bAirborne)
     {
    	 // Object is not airborne/thrown and has stopped moving
     }
     else
     {
    	 // Object is airborn/thrown and has stopped moving
     }
    }
    

     

    You can even get rid of the square root and check against cfMinVelocity*cfMinVelocity to get

    maximum performance =)

     

    Edit:

    Assume a player that can shoot a ball that then bounces off other objects.

    The player shoots the ball and you set the flag bAirborne to true.

    Now the ball flies around and finally hits an object. The collision callback of

    the ball will be called and you can set bAirborne to false. If the collision speed

    was fast enough, you set bAirborne to true again, because the ball will become

    airborne again.

    • Upvote 1
  2. if I am doing that I will just copy the "bg_pos" entity to the Pos entity, but I will not be able later to move that object for example. I will need to search again through all...

     

    I don't know Blitzmax, but in the C/C++ version of LE2 every TEntity, TModel, TMesh, TWhatever is just a pointer.

    That means you are not creating a copy of the actual thing, just a copy of the pointer to it.

  3. I'm pretty much in the same position as Roland, but i have never written much on this forum.

    Just be patient a few more months, then i have something thats worth showing. biggrin.png

    • Upvote 1
  4. As it stands, I'm kinda concerned about the performance/frame-rate I'm getting in the editor.

     

    Unlike most other graphics engines LE2 uses deferred rendering, which has a high initial

    performance impact. The good thing is the performance will not drop as fast as in other

    engines if you add models and lights smile.png

    My guess is that your graphics card is not quite up to date. What do you have?

  5. Stange problem you have there ChrisMAN. I never had problems converting big meshes, but i use UU3D for model conversion.

    If you have some money to spend i recommend buying UU3D(you won't regret it). Other than that you could upload the mesh somewhere and PM me a link, so i can have a look at it.

     

    Is the .gmf correct? Is there a problem? I think .gmf compresses the files...

    29mb compressed to 1k?!? Never laughed that much, thx biggrin.png

  6. I would say it really depends on what you want to achieve. Both are valid options.

    In case you have lots and lots of rooms there will be a noticeable speed difference between using one or four entites per room.

     

    If you have a room like yours with ~400 polygons i see no reason to make it 4 seperate entities.

    It would be a good idea if a single wall had thousands of polygons, but with 400 it's not necessary in my opinion.

  7. I can't give you precise information about "move" and "acceleration", but i can say that those values are not frame rate independent. Means you still need to multiply the passed value by Appspeed() to get it right.

    What i use is a macro for ((1.0f / 60.0f) * Appspeed()), which allows me to use meters per seconds everywhere.

×
×
  • Create New...