Topic: Levitate (physics)

I need some advise. My question is how can I levitate an object in the air . I raise up/down by using

Re: Levitate (physics)

you can make a ray(from camera) to check if you look at the object, and check distance, then disable physics and change it's position (using lerp may be)

Last edited by hog (2014-05-19 12:33:21)

Re: Levitate (physics)

I am really sorry of about missing lines of my question. So my question ending:
"I raise up/down this object (helicopter) by  adding central force, but I can't  helicopter maintain in one place of the air.".

If I disable physics, how it will interaction with the word?


Thanks

Re: Levitate (physics)

I actually did this in my artificial intelligence level accidentally. I parented a cone to the object and made the cone a ghost object with physics.

Now you can check collisions with the cone, and add a central force to the object when something collides with e cone.

If the cone is rotated towards the ground, and it is long enough, then it will act as a ground detection device, and the object will get a jolt every time the cone touches the ground.

Last edited by Tutorial Doctor (2014-05-19 13:53:44)

Re: Levitate (physics)

you can apply the inverse of the gravity multiplied by the mass of the object :

-- scene update
function onSceneUpdate()

    addCentralForce(Object, -getGravity()*getMass(Object))

end

and you can additionally do your regular movement :

-- scene update
function onSceneUpdate()

    addCentralForce(Object, -getGravity()*getMass(Object))
    addCentralForce(Object, vec3(0.1, 0.0, 0.0)) -- additional move toward X

end

Re: Levitate (physics)

Tutorial Doctor wrote:

I actually did this in my artificial intelligence level accidentally. I parented a cone to the object and made the cone a ghost object with physics.

Now you can check collisions with the cone, and add a central force to the object when something collides with e cone.

If the cone is rotated towards the ground, and it is long enough, then it will act as a ground detection device, and the object will get a jolt every time the cone touches the ground.


Thanks and it's good idea!
But actually my "game concept" is a kind of “helicopter game” where the player have to avoid the ground obstacles. So the player task to control the heli., not necessary automatic controlling.

Re: Levitate (physics)

anael wrote:

you can apply the inverse of the gravity multiplied by the mass of the object :

-- scene update
function onSceneUpdate()

    addCentralForce(Object, -getGravity()*getMass(Object))

end

and you can additionally do your regular movement :

-- scene update
function onSceneUpdate()

    addCentralForce(Object, -getGravity()*getMass(Object))
    addCentralForce(Object, vec3(0.1, 0.0, 0.0)) -- additional move toward X

end

Thank you for your advise.
I tried it, but up/down force is not elimated fully by “inverse of gravity”. It is necessary additional correcting controll for the object.  But I think it wouldn’t be a big problem.:).