Jump to content

Get the opposite direction of a moving object


photo

Recommended Posts

I have an object moving from position A to position B

I want to add a physical wind, whose velocity is always the opposite direction of the object's moving direction.

I used the following methods but seems that all of them are not right

1:  wind->setVelocity( -object->getDirection()*speed);

2: get the direction Vector of position A to position B

    wind_direction = vec3(positionB.x - positionA.x,positionB.y - positionA.y, positionB.z - positionA.z).normalize();

    wind->setVelocity( -wind_direction*speed);

 

What should I do? Thanks

Link to comment

Hi de-Roo.Lukas,

Quote

I have an object moving from position A to position B

I have a few questions:
1) How do you move the object? object->setTransform(), object->setVelocity(), object->addForce() or something else?
2) It's a BodyRigid node with some shape and mass?
3) Is the object inside the bounding box of the PhysicalWind node?
 

Quote

I used the following methods but seems that all of them are not right

Both methods should work. Probably the problem is somewhere else.


Best regards,
Alexander

Link to comment

The way I move the object is using the CIGI data from another program

Yes, the body rigid has a shape and a mass, the body rigid is attached to a ropebody.

the object is inside the bounding box  of the physical wind

the physical wind node has the same parent with the bodyrigid 

Link to comment

CigiClient plugin uses setTransform() method to move objects. For a physical engine it's like teleporting in every frame. So, you can not affect the behavior of these objects.

Sorry, i don't understand.
What do you want to do?
Make the rope stretch in the opposite direction?
Or the body rigid which is controlled by the CIGI?
In case of the rope you can use
addParticleForce() directly on the object.
 

Link to comment
×
×
  • Create New...