move by direction
2 posters
Assuming...
Move object in direction of its directions.
transform->loc->x + transform->dir->x * t.
Where t is how much moving to do. Do same for y and z.
transform->loc->x + transform->dir->x * t.
Where t is how much moving to do. Do same for y and z.
goldfrapp0x0309- Posts : 43
Join date : 2009-02-28
Re: move by direction
Goldfrapp wrote:Move object in direction of its directions.
transform->loc->x + transform->dir->x * t.
Where t is how much moving to do. Do same for y and z.
Thanks!!!!!
Earlier, I received an error, because I have not used the correct transform of object
my source
- Code:
angelA = 90 * (
sio2->_SIO2camera->_SIO2transform->dir->x);
cath1 = cos( angelA/SIO2_RAD_TO_DEG )*c;
cath2 = sqrtf(c*c - cath1*cath1);
newobj->_SIO2transform->loc->z = object->_SIO2transform->loc->z;
newobj->_SIO2transform->loc->x = object->_SIO2transform->loc->x;
newobj->_SIO2transform->loc->y = object->_SIO2transform->loc->y;
if(sio2->_SIO2camera->_SIO2transform->dir->x > 0)
newobj->_SIO2transform->loc->x += fabs( cath2 );
if(sio2->_SIO2camera->_SIO2transform->dir->x < 0)
newobj->_SIO2transform->loc->x -= fabs( cath2 );
if(sio2->_SIO2camera->_SIO2transform->dir->y > 0)
newobj->_SIO2transform->loc->y += fabs( cath1 );
else if(sio2->_SIO2camera->_SIO2transform->dir->y < 0)
newobj->_SIO2transform->loc->y -= fabs( cath1 );
Straight Forward Way...
This should do it:
sio2->_SIO2camera->_SIO2transform->loc->x += sio2->_SIO2camera->_SIO2transform->dir->x * (HowMuchUWantToMove);
sio2->_SIO2camera->_SIO2transform->loc->y += sio2->_SIO2camera->_SIO2transform->dir->y * (HowMuchUWantToMove);
sio2->_SIO2camera->_SIO2transform->loc->z += sio2->_SIO2camera->_SIO2transform->dir->z * (HowMuchUWantToMove);
sio2->_SIO2camera->_SIO2transform->loc->x += sio2->_SIO2camera->_SIO2transform->dir->x * (HowMuchUWantToMove);
sio2->_SIO2camera->_SIO2transform->loc->y += sio2->_SIO2camera->_SIO2transform->dir->y * (HowMuchUWantToMove);
sio2->_SIO2camera->_SIO2transform->loc->z += sio2->_SIO2camera->_SIO2transform->dir->z * (HowMuchUWantToMove);
goldfrapp0x0309- Posts : 43
Join date : 2009-02-28
Similar topics
» How to set particle direction ?
» move Z in tutorial06
» move widget
» how can move other object near
» Those that overlap, all the while moving to try to copy and move
» move Z in tutorial06
» move widget
» how can move other object near
» Those that overlap, all the while moving to try to copy and move
Permissions in this forum:
You cannot reply to topics in this forum