Transformations not happening
5 posters
Transformations not happening
Hi,
I'm trying to get a character walking around basically, using the action animations from tut 15 and the simple transformations (rotation, translation) from tut 2. I've got the action animations working but for some reason I can't figure out how to get the object to respond to updated rotation and location values. The values are changing, but the character isn't moving.
Any ideas what I'm missing? Here's the templateScreenTouchMove function I'm using.
T
I'm trying to get a character walking around basically, using the action animations from tut 15 and the simple transformations (rotation, translation) from tut 2. I've got the action animations working but for some reason I can't figure out how to get the object to respond to updated rotation and location values. The values are changing, but the character isn't moving.
Any ideas what I'm missing? Here's the templateScreenTouchMove function I'm using.
T
- Code:
void templateScreenTouchMove( void *_ptr )
{
SIO2object *frankie= sio2ResourceGetObject( sio2->_SIO2resource,
"object/frankie" );
vec2 d0, d1;
d0.x = sio2->_SIO2window->touch[0].x - start.x;
d0.y = start.y - sio2->_SIO2window->touch[0].y;
d1.x = sio2->_SIO2window->touch[1].x - start.x;
d1.y = start.y - sio2->_SIO2window->touch[1].y;
printf("d0.x = %f\n", d0.x);
if( d0.x > 5.0f || d0.x < -5.0f )
{
sio2ObjectSetNextAction( frankie, "walk", 0.25f, 10.0f );
frankie->_SIO2transform->rot->z += ( d0.x * 0.025f );
frankie->_SIO2transform->loc->x += ( d0.x * 0.005);
//printf("rotz %f\n", frankie->_SIO2transform->rot->z);
sio2TransformBindMatrix( frankie->_SIO2transform );
}
}
bugman_2000- Posts : 14
Join date : 2009-04-30
Re: Transformations not happening
You should use Bullet to control the player within the world... setLinearVelocity is probably what you are looking for...
Re: Transformations not happening
Thanks, I've got him moving around now.
bugman_2000- Posts : 14
Join date : 2009-04-30
Re: Transformations not happening
Anyway, If You want to have full control and dynamic feeling - use forces. Especially, If Your player is/can use vehicle.
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Moving, but not correctly
Hi,
Thanks for the replies previously. I got the character moving using forces. However, the linear velocity seems to be pushing him according to global coordinates... at least, the character rotating on its z axis has no effect on the linear velocity coordinates. For turning, I'm using setAngularVelocity, which makes him turn nicely in place, but it has no influence on the direction he moves.
In the tutorials such as tut 6 the camera moves using linear velocity and the rot->z value, but I haven't managed to figure out how to mimic that with this character. I've tried using rot and linear velocity but I can't get him to rotate this way.
Also, a little more explanation would be very welcome about *why* forces are better than location transforms, and more specifically why the transforms have no effect.
Thanks!
T
Thanks for the replies previously. I got the character moving using forces. However, the linear velocity seems to be pushing him according to global coordinates... at least, the character rotating on its z axis has no effect on the linear velocity coordinates. For turning, I'm using setAngularVelocity, which makes him turn nicely in place, but it has no influence on the direction he moves.
In the tutorials such as tut 6 the camera moves using linear velocity and the rot->z value, but I haven't managed to figure out how to mimic that with this character. I've tried using rot and linear velocity but I can't get him to rotate this way.
Also, a little more explanation would be very welcome about *why* forces are better than location transforms, and more specifically why the transforms have no effect.
Thanks!
T
bugman_2000- Posts : 14
Join date : 2009-04-30
Hi
I am very new to sio2. I have been facing some problems and as I am new I am not able to understand
where to put my query. I want to ask you very simple thing. From some where i got some code
and i tried to modify the project so that i can learn and understand the changes. I have one cube and
one object on existing object . like in tutorial 3.
my_object = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource, SIO2_OBJECT, "object/pin" );
my problem is i dont know how to identify that object on touch. I tried with x,y position but if i move the
cube on x or y object than again pin object's x,y will change. i am working in objective c and there
on clicking i can identify the image like
[touch view] == img; thats it . please help me to know more.
I am very interested to learn 3D concepts.
one more thing I have on sio2 file, if i add that to tutorial 3 and change the name in existing project
it is not showing my object. is there any procedure for doing that.
Thanks a lot for reading this post.
Naren
where to put my query. I want to ask you very simple thing. From some where i got some code
and i tried to modify the project so that i can learn and understand the changes. I have one cube and
one object on existing object . like in tutorial 3.
my_object = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource, SIO2_OBJECT, "object/pin" );
my problem is i dont know how to identify that object on touch. I tried with x,y position but if i move the
cube on x or y object than again pin object's x,y will change. i am working in objective c and there
on clicking i can identify the image like
[touch view] == img; thats it . please help me to know more.
I am very interested to learn 3D concepts.
one more thing I have on sio2 file, if i add that to tutorial 3 and change the name in existing project
it is not showing my object. is there any procedure for doing that.
Thanks a lot for reading this post.
Naren
narender.mudgal- Posts : 7
Join date : 2009-08-08
Forces to control vehicle object
@Madman,
Can you please elaborate on using Forces to control a vehicle? I'm have a vehicle in third person cam mode and i'm trying to move it over a terrain with slopes/hills. I'm unable to adjust my vehicle's orientation whenever it goes upslope/downslope.
Thank you
Can you please elaborate on using Forces to control a vehicle? I'm have a vehicle in third person cam mode and i'm trying to move it over a terrain with slopes/hills. I'm unable to adjust my vehicle's orientation whenever it goes upslope/downslope.
Thank you
vikthered- Posts : 25
Join date : 2009-06-25
Re: Transformations not happening
Has anyone implemented the vehicle demo? Is it slow on a device?
vikthered- Posts : 25
Join date : 2009-06-25
Permissions in this forum:
You cannot reply to topics in this forum