Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 10:32
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 604 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
setting a bone's pan tilt and roll directly #146183
08/06/07 18:13
08/06/07 18:13
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
ok, I've tried doing this with ent_bonerotate, but it just continually rotates the bone's pan, tilt, and roll angle's continually. is there a way to set a bone's pan, tilt or roll directly like you would a entity? if not could you guys add this to A6 and A7? this is how i was trying to do it:

Code:

vec_set (temp, you.x);
vec_sub (temp, my.x);
vec_to_angle (temp_pan, temp);
ent_bonerotate (me, "Bone", vector (temp_pan.pan ,0,0));
ent_bonerotate (me, "Bone1", vector (0,temp_pan.tilt,0));



what this does is find's the "you" entity's position and sets a variable (temp_pan) to point at it, much like you would do with a camera or entity, then it tries to use bonerotate to rotate the bone to that angle, but because bonerotate doesn't set the exact angle of the bone, then it just continually rotates the bones...

i could use something like this for many things in my game...


- aka Manslayer101
Re: setting a bone's pan tilt and roll directly [Re: mpdeveloper_B] #146184
08/06/07 20:09
08/06/07 20:09
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
use a ent_bonereset() before changing the angle...

As stated in the manual, ent_bonerotate() adds the angle to the current bone angle. Therefore you must reset the bone to it's original angle first...


xXxGuitar511
- Programmer
Re: setting a bone's pan tilt and roll directly [Re: xXxGuitar511] #146185
08/06/07 21:10
08/06/07 21:10
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
thanks, works great now


- aka Manslayer101
Re: setting a bone's pan tilt and roll directly [Re: mpdeveloper_B] #146186
08/06/07 21:15
08/06/07 21:15
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
now one more question, is it possible to get a bone to reset to a certain frame, like frame 1 or 2 rather than the non-animation frame?


- aka Manslayer101
Re: setting a bone's pan tilt and roll directly [Re: mpdeveloper_B] #146187
08/07/07 06:04
08/07/07 06:04
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
without using ent_animate() to a certain frame, not that I know of...


xXxGuitar511
- Programmer
Re: setting a bone's pan tilt and roll directly [Re: xXxGuitar511] #146188
08/07/07 06:25
08/07/07 06:25
Joined: Jul 2000
Posts: 27,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
Frankfurt
For resetting the bones to a certain frame, first do ent_bonereset() and then ent_animate().

Re: setting a bone's pan tilt and roll directly [Re: jcl] #146189
08/07/07 15:48
08/07/07 15:48
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
it doesn't work for a model that is currently animating, mainly because my models need to blend rather than just animate, so i'm using ent_blend on most of the animations, i've even tried reset the bone to it's position, like this:

Code:

function bone_to_angle (e1, bone_, angle)
{
ent1 = e1;
var defpos1[3];
var newpos1[3];
var defpan1[3];
var newpan1[3];
var defpan2[3];
var rotate_ang[3];
ang_for_bone(defpan2, ent1, bone_);
ang_for_bone(defpan1, ent1, bone_);
vec_for_bone (defpos1, ent1, bone_);
ent_bonereset (ent1, bone_);
ang_for_bone(newpan1, ent1, bone_);
vec_for_bone (newpos1, ent1, bone_);
vec_sub (defpos1.x, newpos1.x);
vec_sub (defpan1, newpan1);
ent_bonemove (me, bone_, defpos1);
rotate_ang[0] = defpan2[0] + angle[0];
rotate_ang[1] = defpan2[1] + angle[1];
rotate_ang[2] = defpan2[2] + angle[2];
ent_bonerotate_parent(ent1, bone_, vector (rotate_ang[0], rotate_ang[1], rotate_ang[2]));
}



what this does is calculates the bone's positions before it resets them and then attempts to put them back at those positions, and add a new angle to them, allowing them to point to something while still animating, but it doesn't work at all, the bone locks somewhere between where it started and where it should be, and starts spinning around in midair funny for the first few times you see it...

i apply it to the code like this:

bone_to_angle (me, "bone9", vector(0,tilt__,0));

the other way i do it is like this:
Code:

function bone_to_angle (e1, bone_, angle)
{
ent1 = e1;
var defpos1[3];
var newpos1[3];
vec_for_bone (defpos1, ent1, bone_);
ent_bonereset (ent1, bone_);
vec_for_bone (newpos1, ent1, bone_);
vec_sub (defpos1.x, newpos1.x);
ent_bonemove (me, bone_, defpos1);
ent_bonerotate_parent(ent1, bone_, vector (angle[0], angle[1], angle[2]));
}



this results in something more stable, but when the you rotate the entity then the bone stretches out of place...

what i want to do with this is set it back to the original pan, tilt, and roll angles and then add the new angle to it, perhaps you could show me how, jcl?

note: i made sure that i ran these functions after animation

wouldn't it just be easier to be able to set a bone's pan through exact vector calculations?

Last edited by Manslayer101; 08/07/07 16:09.

- aka Manslayer101
Re: setting a bone's pan tilt and roll directly [Re: mpdeveloper_B] #146190
08/08/07 19:22
08/08/07 19:22
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
var exactAngle[3] = 0, 45, 0;

vec_set(temp, exactAngle);
vec_sub(temp, my.pan);
ent_bonereset(my, "bone");
ent_bonerotate(my, "bone", exactAngle);



...Line in Yellow might be needed (not sure)


xXxGuitar511
- Programmer
Re: setting a bone's pan tilt and roll directly [Re: xXxGuitar511] #146191
08/09/07 19:04
08/09/07 19:04
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
i still need the bone to be at the location in each animation, and move to the new position, ah well, that's one idea shot down perhaps something to add in the future jcl?


- aka Manslayer101
Re: setting a bone's pan tilt and roll directly [Re: mpdeveloper_B] #146192
08/10/07 08:20
08/10/07 08:20
Joined: Jul 2000
Posts: 27,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
Frankfurt
I admit that I don't fully understand your problem, but I'm moving this to the engine forum - maybe another user can help you with bones animation.


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1