About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Character position according to animation
Author Message
Rabishan Offline
Member

Post: #1
Character position according to animation
hi community,

this maybe a noob question smile. but when i play animations, the controller position remains at the same position instead of moving to the new position according to the animation. i tried to change the controller position according to skeleton point position but it gave bad results. so you guys know how to achieve this.

thanks,
10-04-2012 01:45 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #2
RE: Character position according to animation
Are you talking about something like walking? Just use position += (Time.d() * speed) * direction where you adjust speed to match the animation's movement. That would be the best way, so you don't have to adjust the animation if you want to speed up or slow down your object.
10-04-2012 03:52 PM
Find all posts by this user Quote this message in a reply
Rabishan Offline
Member

Post: #3
RE: Character position according to animation
thanks for the reply @Rubeus. but i mean something like jumping type animations where character positions are changed but controller position remains at same place as you can see in the image i've attached.


Attached File(s) Image(s)
   
10-05-2012 04:53 AM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #4
RE: Character position according to animation
Personally, I would make the jump animation not actually move upward, and implement the vertical movement through code.
10-05-2012 01:57 PM
Find all posts by this user Quote this message in a reply
TBJokers Offline
Member

Post: #5
RE: Character position according to animation
Why dont you put a point into your skeleton, and then have an Event set, then you can do so that you calculate the new position of the character like:

if(Motion.playing())Player.pos=cksel.finBonePoint("Position").pos;

You wont be able to copy & paste that, but i hope you get the idea.

Man, it's always that semicolon...
10-05-2012 02:34 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Rabishan Offline
Member

Post: #6
RE: Character position according to animation
thanks for reply guys.

skeleton point doesnot work as expected. if i change the position according to skeleton point the y position rises up exponentially as you can see in the video.





manually changing position might work but we will have to change the current animation. since there are other animations which may require position chages too, is there some easy way to do this.

thanks,
(This post was last modified: 10-09-2012 05:43 PM by Rabishan.)
10-09-2012 05:41 PM
Find all posts by this user Quote this message in a reply
SamNainocard Offline
Member

Post: #7
RE: Character position according to animation
Not sure if you have solved it, I was going to do the same yesterday.

You need a skeleton for position, like TBJokers one and one Vec.

By placing "position" bone at root of character and move it to where you want instead of moving whole mesh.

PHP Code:
Vec OldPos;   // Position before position movement by animation

if(/*Motion is starting*/)
{
   
OldPos=ctrl.actor.pos(); // or cskel.getBone("position").matrix().pos;
   
ctrl.actor.freezePos(true);      // opinion
}

if(
/*Motion is playing*/)
{
     
ctrl.actor.pos(OldPos+(cskel.getBone("position").matrix().pos-ctrl.actor.pos()));


With this controller will move to "position" and sync with mesh.

Edit: The only problem is it can move through wall. Maybe required some position check like camera.
(This post was last modified: 10-24-2012 01:32 PM by SamNainocard.)
10-19-2012 11:22 AM
Find all posts by this user Quote this message in a reply
Post Reply