Jump to content

SetbodyForce etc???


cassius
 Share

Recommended Posts

SetBodyForce

AddBodyForce

SetBodyVelocity

 

Although the meaning of the above functions are selfevident I have never been sure WHEN they are needed or what they can be used for or whether to put them in main loop or not

Can someone give me some idea of different ways of using them.Thanks

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

They will be useful If physics is a part of gameplay.

 

Examples:

1. Picking up and levitating (carrying) crates.

2. Pushing (shooting) cannonball.

3. Kicking the ball in football /baseball / tennis.

4. Imitation of the blast wave.

5. Moving parts of machinery.

And so on...

Link to comment
Share on other sites

SetBodyVelocity sets an absolute speed on a body. Use it to make a body move at a certain speed. Be careful though because setting a Y velocity of 0 will "remove" gravity's influence, which can cause an object to be suspended in mid-air

 

SetBodyForce applies to specified force to the body. Speed however is not constant, because an object with a large surface area suffers greater friction than an object with a smaller surface area.

 

AddBodyForce is the same as SetBodyForce, but it takes into account any forces already acting on the body rather than overwriting them with the new one.

 

 

In the C newton interface, the force commands can only be used during the ApplyForceAndTorque callback. I believe however in Leadwerks that these can be called at any time, because the callback is hidden from you, and these functions instead probably just update a hidden variable called something like BodyForce, which is then read in the hidden callback.

 

SetBodyVelocity can always be used at any time, both in Leadwerks, and in the C newton interface.

  • Upvote 1

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

Thanks for explanations. I have a problem with enemy controller where the controller slides backwards constantly after coming near main character and I wondered if any of the force commands were of any use with this problem. From your explanation it seems something else is causing it..I am not using any forces currently.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

Do you using controllers for both NPCs and main character?

Do you moving controllers with UpdateController() function?

Don't you scale controllers? Scaling physics bodies causing problems with colliding.

 

I have no any problems with collided controllers. You can see it in video below.

 

Link to comment
Share on other sites

I fixed all controller problems now exept one.After my enemy character goes through its die routine it slides across floor. Maybe I should use freeEntity on enemy controller once the character is dead.

This only happens when I move main character(player)

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...