Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/25/26 19:13
ZorroGPT
by TipmyPip. 04/25/26 16:09
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (Quad), 3,790 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
arbitrary axis bone rotation (still need help) #139177
07/02/07 14:50
07/02/07 14:50
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline OP
Member
yorisimo  Offline OP
Member
Y

Joined: Mar 2007
Posts: 197
I want to rotate a bone about it's own axis rather than the one of the world axes. I've tried using ang_add and ang_rotate but haven't achieved what I want. The picture below should indicate this. Suggestions? Thanks!

if(key_cul==ON) {pronation-=1;}
if(key_cur==ON) {pronation+=1;}
ent_bonereset_all(arm);
vec_set(off_axis_ang.pan,vector(0, 0, 20)); //Z' axis rolled 20 from Z axis
vec_set(elbow.pan, vector(pronation, 0, 0));
ang_rotate(elbow.pan, off_axis_ang.pan);
ent_bonerotate(arm,"bone2", elbow.pan);



Last edited by yorisimo; 07/03/07 13:00.
Re: arbitrary axis bone rotation (need help) [Re: yorisimo] #139178
07/02/07 14:58
07/02/07 14:58
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
some_angle += 5 *time_step;
ent_animate(me,null,0,0);
ent_bonerotate(me,"bone2", vector(0,0,some_angle)); //pan/tilt/roll so in this case you changing bone's roll but you want change bone's pan

So You should play with vector(some_angle, some_angle, some_angle) to check which one rotates your bone aroud axis you want to?

Last edited by tompo; 07/02/07 15:09.
Re: arbitrary axis bone rotation (need help) [Re: tompo] #139179
07/02/07 15:06
07/02/07 15:06
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline OP
Member
yorisimo  Offline OP
Member
Y

Joined: Mar 2007
Posts: 197
ent_bonerotate does NOT rotate about its own axis (unless there is some setting or some way to define this axis in MED that I am unaware of). ent_bonerotate uses the local axis defined due to rotations of parent bones, but not the axis of the bone itself. The code you suggested rotates the bone about the world roll axis when I try it (assuming I don't rotate bone1 first)


Joris Lambrecht
My Contributions: Relative Rotation, Window Sizing
Re: arbitrary axis bone rotation (need help) [Re: yorisimo] #139180
07/02/07 15:15
07/02/07 15:15
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
1. Post above edited
2. From manual:
Quote:


Ent_bonerotate rotates an entity bone, it's childs and all attached vertices about it's hinge point. This is the normal rotate mode.
Ent_bonerotate_parent rotates an entity bone, it's children and all attached vertices about it's parent's joint. This corresponds to rotate3 mode in MED.





Last edited by tompo; 07/02/07 15:16.

Never say never.
Re: arbitrary axis bone rotation (need help) [Re: tompo] #139181
07/02/07 15:24
07/02/07 15:24
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline OP
Member
yorisimo  Offline OP
Member
Y

Joined: Mar 2007
Posts: 197
"about it's hinge point" but given world pan/tilt/roll for its rotation. If I try rotating using pan, tilt, or roll, I get rotation about those axes. I need some combination of the rotations to get it about my arbitrary axis. ang_rotate and ang_add are supposed to be used for arbitrary axis rotations but its not working as I expect.

Re: arbitrary axis bone rotation (need help) [Re: yorisimo] #139182
07/03/07 13:02
07/03/07 13:02
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline OP
Member
yorisimo  Offline OP
Member
Y

Joined: Mar 2007
Posts: 197
I understand that the rotation of a bone is defined about the hinge POINT of itself (ent_bonerotate) or of its parents bone (ent_bonerotate_parent), but the hinge point does not define the AXIS or AXES for rotation


Joris Lambrecht
My Contributions: Relative Rotation, Window Sizing
Re: arbitrary axis bone rotation (need help) [Re: yorisimo] #139183
07/04/07 17:16
07/04/07 17:16
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
There isn't an exact feature for what your looking for. You'll have to code it yourself.

- get the angle of the bone
- set temp to the target angle
- ang_rotate() the original angle by temp
- set the bones angle to result

Code:

Function rotateBone(strBone, &cAng, &tAng)
{
vec_set(temp, cAng);
ang_rotate(temp, tAng);
vec_sub(temp, cAng)
ent_bonerotate(my, strBone, temp);
}



strBone: Name of the bone.
cAng: Current angle of the bone. I couldn't find a function for getting a bones angle, so you may have to keep track of your bone_rotates.
tAng: This vector contains the relative angle to add to the current angle.


xXxGuitar511
- Programmer

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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