Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, howardR), 472 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Angles and IK CCD Help #453187
07/10/15 20:31
07/10/15 20:31
Joined: Jan 2006
Posts: 968
EpsiloN Offline OP
User
EpsiloN  Offline OP
User

Joined: Jan 2006
Posts: 968
Can anyone translate this into Lite-C?
Quote:
We create two vectors: one from the last joint position to the endpoint of the last bone (the effector) and another from the same last joint to the target we are trying to reach. Now we can compute the angle between these two vectors by computing the dot product of their unit vectors. Notice that we have the angle between two vectors, but we need to make sure we rotate in the appropriate direction to make the shortest path possible. Again, we can use our AI knowledge by performing a cross product between the two vectors to obtain a third, perpendicular vector. Then, we use the sign of the Z coordinate of the newly computed vector. This sign determines the direction at which we must rotate, and the arc-cosine of the dot product will give you the angle.


I can understand two vec_to_angle for finding bone direction and destination direction, and one ang_diff between the two angles, but nothing more grin

Can anyone clarify?

PS.: Any thoughts on how to get the length of a bone by script? Cant find any functions in the Manual...

Thanks.

*** EDIT ***
Or, how to get the bone pos?? Cant find a function for that either grin
Oops, found it: vec_for_bone() gives the hinge(joint) before that bone, I think. Could be used to get a bone starting pos...

Last edited by EpsiloN; 07/10/15 20:49.

Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Angles and IK CCD Help [Re: EpsiloN] #453199
07/11/15 12:29
07/11/15 12:29
Joined: Jan 2006
Posts: 968
EpsiloN Offline OP
User
EpsiloN  Offline OP
User

Joined: Jan 2006
Posts: 968
No replys yet, but here's a thought (dont have time to test it right now)
Example:
Rotate an angle to point from elbow to target, rotate the first bone by that angle,
then for the bicep bone...

Get a dummy angle to point from shoulder to target, and get another to point from shoulder to wrist (those are two angles from two vectors) and then use ang_diff to get the difference and rotate the bicep bone with the difference.

Those two operations repeated over and over will turn an arm towards a point in space...
For more bones, the procedure for the bicep bone is repeated for every bone, turning an angle towards the target, an angle towards the last bone in the chain (effector, or eg. a finger) and turn that bone by the difference of those two angles and go to next bone or iteration.

Gonna test it tonight, if I have the time...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201

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

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