Posted: Sun Nov 14, 2010 7:37 pm
how to move an object without accelerating and decelerating? sorry i'm new to game physics.
Official forum of the Irrlicht Engine
https://irrlicht.sourceforge.io/forum/
Code: Select all
irr::matrix4 mat = rigidbody->getWorldTransform();
mat.setTranslation(irr::core::vector3df(20,20,20));
rigidbody->setWorldTransform(mat);
Code: Select all
matrix4 mat = body->getWorldTransform();
vector3df rot = mat.getRotationDegrees();
mat.setRotationDegrees(rot - vector3df(0, 1 * speed, 0));
body->setWorldTransform(mat);
it won't work if the body isn't set as kinematic body. In order to move an object "legally" into the bullet world is to set it as kinematic bodycobra wrote:Virion:
Code: Select all
irr::matrix4 mat = rigidbody->getWorldTransform(); mat.setTranslation(irr::core::vector3df(20,20,20)); rigidbody->setWorldTransform(mat);
weird. i set my body to kinematics and it won't work anymore.Zurzaza wrote:it won't work if the body isn't set as kinematic body. In order to move an object "legally" into the bullet world is to set it as kinematic bodycobra wrote:Virion:
Code: Select all
irr::matrix4 mat = rigidbody->getWorldTransform(); mat.setTranslation(irr::core::vector3df(20,20,20)); rigidbody->setWorldTransform(mat);
Code: Select all
body->setCollisionFlags(ECF_KINEMATIC_OBJECT);
hmm..it looks very strange.Virion wrote: weird. i set my body to kinematics and it won't work anymore.
then i set it back to character object and it works again. but still the rotation is locked at 90 degree.Code: Select all
body->setCollisionFlags(ECF_KINEMATIC_OBJECT);
So, i can't explain why your object can be movedKinematic rigidbodies: can be animated by the user, but there will be only one-way interaction: dynamic objects will be pushed away but there is no influence from dynamics objects
The problem with this is, that getWorldTransform() returnd wrong rotation. My workaround was, to store the rotation manually in a variable, instead of getting it from the bodyVirion wrote:thx for the help cobra. now i'm trying to rotate my object when i pressing a button. it works fine at first but when it reaches 90 degree it won't rotate anymore.thx in advanceCode: Select all
matrix4 mat = body->getWorldTransform(); vector3df rot = mat.getRotationDegrees(); mat.setRotationDegrees(rot - vector3df(0, 1 * speed, 0)); body->setWorldTransform(mat);
Code: Select all
int RotY= 0;
IRigidBody* Body;
...
void rotate(float degrees)
{
rotY+= degrees;
matrix4 mat= body->getWorldTransform(); //we get the transform, just to get correct translation and won't use the rotation from it
mat.setRotationDegrees(vector3df(0, rotY, 0));
body->setWorldTransform(mat);
}
Code: Select all
body->getCollisionShape()->getSceneNode()->getAbsoluteTransformation().getRotation()
Birdman wrote:This files gives me trouble in Softbody.h:
#include <map.h>
#include <vector.h>
Both files seems to be missing, maybe i did something wrong?
This happens to me with 1.65 only.