Play Animation at random times

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 12 December 2008   #1
Play Animation at random times

Hi guys,

for my current project it would facilitate my animation process a lot if I could solve my problem with MaxScript.

I have several objects of which each has to move to one point and back at a set speed and at random times. Like frog that sits on one side of the street and jumps to the other side and back if he's getting poked.

I thought the best way would be to check for a "poke", determine when the object is at the target position, so it wouldn't accept any more "pokes" until it's back at its original position. But then, how do I determine the current position of the object? this.pos does not work since it is a script controller. I'd be glad if someone can shed some light on this.

Thanks in advance!

Regards,
eclaw
 
Old 12 December 2008   #2
Just script it, over time:
-- point and frog must be in different locations
(
local target = $frog
local point = $point01
local endPos = [0,0,0]
local interval = 10
local sTime = 0
local eTime = (sTime + interval)

local startPos = $point01.pos

for f = animationRange.start to animationRange.end do
(
slidertime = f

if (f => eTime) then
(
startPos = point.pos
local r = random 0.0 1.0
sTime += interval
eTime = (sTime + interval)
target.pos = ((1 - r) * target.pos + ((1-0.5) * target.pos + [0,0,0] * 0.5) * r)
)
else
(
point.pos = (((f-sTime)/(eTime-sTime))* startPos.pos  + ((f-sTime)/(eTime-sTime))*target.pos)
)



)


)

something like this roughly..
__________________
Disclaimer: My opinions are not those of my employer.



Last edited by eek : 12 December 2008 at 04:25 AM.
 
Old 12 December 2008   #3
Wow! I kinda got it to work on my own (took a few hours, it's my first script), but yours looks much more elegant. Thanks man!
 
Old 12 December 2008   #4
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:33 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.