I want to use Animation.Sample function in sage controller.

I want to use Animation.Sample function in sage controller.

PostPosted by instil » Wed May 16, 2012 12:56 am

Hi. I bought sage controller source to use Animation.Sample function.
However, I couldn't find source to modify.

This is what I want to do
Code: Select all
AnimTarget[animation].time = time;
AnimTarget.Sample();

Vector3 pos = transform.position;
Vector3 angle = transform.eulerAngles;

// blah blah...


Which source file is modified to apply above code? SageBaseLibrary?
Please give me some advice.

Thanks.
instil
 
Posts: 3
Joined: Tue May 15, 2012 9:42 pm

Re: I want to use Animation.Sample function in sage controll

PostPosted by AlteredReality » Wed May 16, 2012 10:45 pm

I'm not exactly sure what you are trying to accomplish.

Are you trying to modify an animation time after Sage has been updated for a frame, and then sample the animation? So that way you can get transform info? If so, you'd want to look at SageController.Update(). After the library runtime is updated.

If that's not what you are after, please clarify what exactly you are trying to accomplish, and i'll try to point you to a more appropriate place in the code.
Andy - Altered Reality
AlteredReality
Site Admin
 
Posts: 118
Joined: Fri Jan 06, 2012 8:31 pm

Re: I want to use Animation.Sample function in sage controll

PostPosted by instil » Wed May 16, 2012 11:06 pm

Sorry, I'm not good at English.

When attack animation is playing, I want to draw weapon trail smoothly.
So I have to divide each frame time with very small gab, and apply each time with Animation.Sample() to get position and rotation of animated GameObject.

When is animation time applied to GameObject?
I didn't find any Play(), Crossfade(), Blend() function or Sample() function.

Help me, thanks.
instil
 
Posts: 3
Joined: Tue May 15, 2012 9:42 pm

Re: I want to use Animation.Sample function in sage controll

PostPosted by AlteredReality » Thu May 17, 2012 10:25 am

Oh, okay, I see what you need to do. Animation is Sage is done by directly modifying the AnimationState objects, and not really calling any of the functions you mentioned.

With what you want to do, I would honestly handle most of that external to most of Sage's functions. I would use animation events to turn the trail on and off (such as trail_on and trail_off). After the runtime library is done updating, I would still call Animation.Sample() to force all transforms to be applied. After that, you would need to run the code that handles the trail. Does that help at all?
Andy - Altered Reality
AlteredReality
Site Admin
 
Posts: 118
Joined: Fri Jan 06, 2012 8:31 pm

Re: I want to use Animation.Sample function in sage controll

PostPosted by instil » Sun May 20, 2012 9:44 pm

Thank you for your answer.
I'll try. Thanks.
instil
 
Posts: 3
Joined: Tue May 15, 2012 9:42 pm

Re: I want to use Animation.Sample function in sage controll

PostPosted by AlteredReality » Mon May 21, 2012 9:04 am

Cool, let me know how that works for you, or if you need any more help at all! :)
Andy - Altered Reality
AlteredReality
Site Admin
 
Posts: 118
Joined: Fri Jan 06, 2012 8:31 pm

Re: I want to use Animation.Sample function in sage controll

PostPosted by shivajs » Wed Oct 09, 2013 12:41 am

Hey, hope you don't mind me tacking this onto the end of someone else's thread. But it's related, so it seemed appropriate.

I too am working on weapon trails, which I have working in a way similar to what you suggest above (animation events to turn them on/off). The trail isn't particularly smooth though, as the sampling is frame-rate dependent. It's this that I am attempting to solve.

I've tried modifying SageController so it passes smaller fixed interval delta times through to the SageLibrary multiple times each frame and then sampling the animation controller, but since Sage just sets properties of the AnimationState, it's still frame-rate dependent.

Have you got any ideas?
shivajs
 
Posts: 4
Joined: Wed Oct 09, 2013 12:34 am

Re: I want to use Animation.Sample function in sage controll

PostPosted by AlteredReality » Wed Oct 09, 2013 8:04 pm

shivajs wrote:Hey, hope you don't mind me tacking this onto the end of someone else's thread. But it's related, so it seemed appropriate.

I too am working on weapon trails, which I have working in a way similar to what you suggest above (animation events to turn them on/off). The trail isn't particularly smooth though, as the sampling is frame-rate dependent. It's this that I am attempting to solve.

I've tried modifying SageController so it passes smaller fixed interval delta times through to the SageLibrary multiple times each frame and then sampling the animation controller, but since Sage just sets properties of the AnimationState, it's still frame-rate dependent.

Have you got any ideas?


I don't mind you jumping onto another thread at all. :-)

I'll be honest, I don't know much about how weapon trails work in Unity, so I can't speak much to the specific implementation you are using. My experience with them has been that they are dynamic geo that is updated base on the difference between poses. If the frame rate is low, you will indeed get jagged trails. If it's high, they will be smoother. If you are trying to smooth them out by updating the controller multiple times in a frame, you'd need to make sure you update the geo in between each pose update. If that doesn't work for you, I'm not sure off the top of my head how else you'd go about smoothing them.

Also, are you making sure the outsides of the trail is not a hard edge? About all else i can think of.

Let me know if that helps at all.
Andy - Altered Reality
AlteredReality
Site Admin
 
Posts: 118
Joined: Fri Jan 06, 2012 8:31 pm

Re: I want to use Animation.Sample function in sage controll

PostPosted by shivajs » Wed Oct 09, 2013 8:17 pm

Thanks for the prompt reply.
You're right about how the trails work. I am attempting to smooth by updating the controller multiple times, and I already am updating the trail geometry in between each update. The problem is that the sage update doesn't generally change the pose immediately, it changes AnimationState properties like speed, and relies on the animation update changing the bone transforms.
shivajs
 
Posts: 4
Joined: Wed Oct 09, 2013 12:34 am

Re: I want to use Animation.Sample function in sage controll

PostPosted by AlteredReality » Sat Oct 12, 2013 9:37 pm

shivajs wrote:Thanks for the prompt reply.
You're right about how the trails work. I am attempting to smooth by updating the controller multiple times, and I already am updating the trail geometry in between each update. The problem is that the sage update doesn't generally change the pose immediately, it changes AnimationState properties like speed, and relies on the animation update changing the bone transforms.


I believe you'd have to call Animation.Sample() on whichever animations you'd like to apply the pose for.
Andy - Altered Reality
AlteredReality
Site Admin
 
Posts: 118
Joined: Fri Jan 06, 2012 8:31 pm

Next

Return to Questions and Discussion

Who is online

Users browsing this forum: No registered users and 1 guest


Style by Gokinstudio | Free forum hosting by ProphpBB | Software by phpBB | Report Abuse | Privacy
cron