Results 1 to 2 of 2

Thread: Objects that are not affected by Gravity

  1. #1

    Objects that are not affected by Gravity

    Hello there.

    Im trying to do a flying FireBall. But it schould not act like a normal pysical object that is affected by Gravity. It should just fly strait in the direction that it was fired an explode at a special Range or if it hit something. Till now i only get it working by seting the velocity of the dmm object in every frame. So it flys and flys and flys. Like i need it, but im not shure if there are better ways. I was not able to find a function to set the gravitiy for a single object. Maby it would work if i add a force that is same like the grafity but in the opposite direction? Any ideas?

  2. #2

    Re: Objects that are not affected by Gravity

    Hi GRAuM,

    We unfortunately don't have a way to turn off gravity on specific objects right now. For now, you could do either one of the things you're suggesting, although using AddForce is a bit tricky, and would have to be applied every frame just like the velocity anyways. This is because a force has a one-frame lifetime in DMM.

    If the fireball is moving fast, you want to set the OBJECT_FAST_COLLIDER_BIT on the object, which makes it a bit more expensive, but helps alleviate the "bullet through paper" problem.

    You might want to handle the fireball as a "driven" object. Confusingly, we also call this kind of object "fixed" (sorry, it's an artifact of history). This means the motion of the object is completely controlled by the user instead of DMM simulation, except other DMM objects respond to it by collision. This can save simulation time and memory, particularly if you use the OBJECT_FIXED_ONLY_BIT. If you go this route, you call Object::SetNodesSingleState to set the NODE_DRIVEN_BIT on all the nodes of the object. Then to move the object, you would call Node::GotoPos or Object::NodesGoToPos to move the fireball each frame. Unfortunately, if you do it this way, you are still calling something every frame; this is because the fireball is not simulated by DMM at all in this case, so you can't rely on velocity to update positions for you.
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” - Don Knuth

Similar Threads

  1. 3D space, gravity?
    By santiainen in forum Support
    Replies: 1
    Last Post: 12-22-2010, 11:28 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts