|
|
bone rotate
#130838
05/20/07 18:25
05/20/07 18:25
|
Joined: Apr 2006
Posts: 329
molotov
OP
Senior Member
|
OP
Senior Member
Joined: Apr 2006
Posts: 329
|
A time ago I posted a similiar question on this forum about bone rotation. The response on that post resulted in the following code, which worked for my previous project. But now I implemented it in a other project and now I get weird results. Here's the code;
var temp3[3]; var temp4[3]; var bone_angle[3]; // a vector that will hold the pan, tilt and roll angles temp3.x = (screen_size.x / 2); temp3.y = (screen_size.y / 2); temp3.z = 10; vec_for_screen(temp3,camera);
temp4.x = (screen_size.x / 2); temp4.y = (screen_size.y / 2); temp4.z = 8000; vec_for_screen(temp4,camera); trace_mode = ignore_me+ignore_passable; target = trace(temp3,temp4);
var tPos[3]; var tAng[3]; ent_bonerotate(my, "bone22", nullvector); vec_diff(tPos, Target, my.x); vec_to_angle(tAng, tPos); vec_sub(tAng, my.pan); ent_bonerotate(my, "bone22", tAng);
The function should rotate bone22 in such way it points to the target position. The target is based on a trace between two points in the camera view. When I use this code in my new project it rotates the bone22 in every direction. Hope someone can tell me what's wrong with my code? Thanks anyway, Molotov.
|
|
|
Re: bone rotate
[Re: molotov]
#130841
05/21/07 11:02
05/21/07 11:02
|
Joined: Mar 2007
Posts: 776 Poor village - Poland ;)
tompo
User
|
User
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
|
This is a FPP or TPP ? 1. IF FPP you can trace from player and not from camera 2. If TPP you may trace from camera not from 10 quants front of camera Maybe something like this: Code:
ent_animate(me,NULL,0,0); vec_set(temp,target.x); vec_sub(temp,my.x); vec_to_angle(tAng,temp); ent_bonarotate(my,"bone22", tAng);
Last edited by tompo; 05/21/07 11:21.
Never say never.
|
|
|
|