Script animation to not start until time

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Script animation to not start until time // Scriptorium

1  |  

Post by kena // Apr 20, 2008, 9:35pm

kena
Total Posts: 2321
pic
How do I script, or use available scripts to make an object not move until a certain time frame?

I have some objects that I cannot get to stop wobbling, and want to keep them still until just before they are struck.

Post by Johny // Apr 21, 2008, 4:40am

Johny
Total Posts: 672
pic
Hello Kena, You can use this RsObj.

Change the value of "From" and "Until" to the range of keyframe time you want your script obj running. ;)

As example from below image, your script obj will running only from keyframe time 100 until keyframe 200.

HTH!

Post by kena // Apr 21, 2008, 5:00am

kena
Total Posts: 2321
pic
Thanks Johny! I really appreciate that.


have a bananna! :banana:


EDIT: oh, darn... I should have been more specific.... That did not do what I wanted it to do.


What I need is to activate the physics of the object at a certain timer event.


12167


I want to activate the physics of my object when the current time reaches, say, 17.2


So what I need is something that will put that check in at "Active" at that point.


But you can keep the bananna :D

Post by Burnart // Apr 21, 2008, 3:19pm

Burnart
Total Posts: 839
pic
I don't really know this stuff myself but I thought you could create a physics "reaction" by running your simulation then convert the result into a clip and then slide it anywhere you like on the time line. Then you need a clip of the static object for the first part of the anim.


(Of course this is from someone who has read some chapters of the manual but never actually done it so I could be talking through my hat.)

Post by trueBlue // Apr 21, 2008, 3:54pm

trueBlue
Total Posts: 1761
pic
Go inside the object in question and export the PhysObject/Constraint/Active attribute. With your object selected add this attribute to the Keying panel. Then you can record a keyframe with it off until needed.
12171
Nice one Johny! :)

Post by kena // Apr 21, 2008, 8:55pm

kena
Total Posts: 2321
pic
Actually, instead of keyframe, I was trying to do a completely physics related animation. so I start the physics recording, and a ball rolls down and hits the object, but the object just sits there and wobbles until the ball hits it to knock it down. It doesn't look too real that way. making the cube fatter causes it to not fall over, but get pushed instead. Or it causes it to fall down immediately.

here is a quick test. Note that the ball doesn't even come into the screen before the block is down.
12172

Post by Wigand // Apr 27, 2008, 9:03am

Wigand
Total Posts: 462
pic
Sorry Kena, I search and could not find a way to activate physics of an object while physics is running in TS7.51.

Maybe there is an other way you can choose to do your animation.

Post by Johny // Apr 28, 2008, 5:32am

Johny
Total Posts: 672
pic
Dont worry Kena, here a prototipe RsScn file for show how to make some phys obj run later on your setting time. :)

No more banana please. This time I want a pineapple. :D

Post by Johny // Apr 28, 2008, 5:37am

Johny
Total Posts: 672
pic
...Nice one Johny! :)
Thanks trueBlue! :)

Post by kena // Apr 29, 2008, 4:37am

kena
Total Posts: 2321
pic
Thanks Johny... I will try that out when I get back from work tonight. See what it helps with and all. I would have picked it up yesterday, but I was not even online. worked all weekend pulling an extra 20 hours in 2 days. so I had to catch up on sleep.

Post by kena // Apr 29, 2008, 6:48pm

kena
Total Posts: 2321
pic
well... It looks like what I'm trying to do, so all I have to do now is try to incorporate it into my scene and see if I can get it to work.

Thanks again Johny!

Post by Johny // Apr 30, 2008, 1:17am

Johny
Total Posts: 672
pic
You're welcome Kena. :)
Wish to see your phys animation on Caligari monthly animation contest. :D

Post by kena // Apr 30, 2008, 8:17pm

kena
Total Posts: 2321
pic
I was hoping to have it done for this month.. maybe next month... Having a problem though. I have more than one object to delay, and they have to delay in a series about .500 time-clock after each other. When I tried to duplicate your wonderful script, the first one fires, but the rest do not.

Here is your example with an added object to it.

When you put a check on the timer events, the second one seems to make everything else loop.

remove the second timer event and connect the first to the second script instead... and since the check goes away with the first one, it does not fire the second one.


Maybe you could take a look at it and see what is going on?

Post by Johny // May 1, 2008, 4:35am

Johny
Total Posts: 672
pic
For easy explaination let rename:
Timer Event become TimerEventStep1
Timer Event, 1 become TimerEventStep2
MainScript become ScriptStep1
MaintScript, 1 become ScriptStep2

Kena, you make two 2 error on you post RsScn file:

1. You not change script code on "ScriptStep2" obj on line 10
you must change it become TimerEvent = Space.CurrentScene()+"/TimerEventStep2";
where TimerEventStep2 is timer event name that call the ScriptStep2

2. You connected physEngine continue flag with 2 links (one from ScriptStep1 and one other from ScriptStep2)
This is can cause make PhysEngine continue port receive value 1 and value 0 at the same time!!!
To make it work safer, you only need connected one input to it. On this case, you must connected the lastest ScriptSteps obj (ScriptStep2 on this case). REMMEMBER!! only connect last step PhyContinueValue's port to physEngine continue port.

here the work RsScn.
Hey where my pineapple. :D

PS: remember the steps: AllTimerEvent active flag or reset all positions, then start physEngine.

Post by kena // May 1, 2008, 12:01pm

kena
Total Posts: 2321
pic
see... I KNEW I must have been doing something wrong.


and here is your pineapple


http://img.photobucket.com/albums/v623/greypiffle/smilies/Pineapple.jpg

Post by Johny // May 1, 2008, 1:31pm

Johny
Total Posts: 672
pic
Kena!!! I just kiding about pineapple :D.

Post by kena // May 1, 2008, 3:11pm

kena
Total Posts: 2321
pic
ya got one anyway! Now... If I add a script 3 would I plug the continue into both script2 and script3?
I will do some experiments and see what I get

EDIT: OK - add a third, and make sure that the continuevalue is moved from the second one to the third one, and change the script to match the third timer event. Got it!

Post by kena // May 1, 2008, 7:27pm

kena
Total Posts: 2321
pic
Steep learning curve... How do I script the reset so that it puts objects not only back at x y z (which I figured out) but also the rotation?
I run the script the first time, and the rotated cone snaps back to it's original rotation, but when I run the script the second time after resetting position, it does not.
Since I have several blocks that tip over , I need to be able to reset them to their original positions and rotations.

Here is the script so far:

function Execute(params)
{
coneA = Space.CurrentScene()+"/ConeA";
coneB = Space.CurrentScene()+"/ConeB";
coneC = Space.CurrentScene()+"/ConeC";
coneD = Space.CurrentScene()+"/ConeD";
Space.NodeMatrixElement(coneA,'tz')=8;
Space.NodeMatrixElement(coneA,'ty')=0.596;
Space.NodeMatrixElement(coneA,'tx')=-2.727;
Space.NodeMatrixElement(coneB,'tz')=8;
Space.NodeMatrixElement(coneB,'ty')=2.051;
Space.NodeMatrixElement(coneB,'tx')=2.213;
Space.NodeMatrixElement(coneC,'tz')=8;
Space.NodeMatrixElement(coneC,'ty')=10.804;
Space.NodeMatrixElement(coneC,'tx')=-2.367;
Space.NodeMatrixElement(coneD,'tz')=8;
Space.NodeMatrixElement(coneD,'ty')=5.887;
Space.NodeMatrixElement(coneD,'tx')=-3.910;
}

Post by trueBlue // May 1, 2008, 10:03pm

trueBlue
Total Posts: 1761
pic
You would add roll, pitch, and yaw.

Space.NodeMatrixElement(coneB,'roll')=0;
Space.NodeMatrixElement(coneB,'pitch')=0;
Space.NodeMatrixElement(coneB,'yaw')=0;

Here is a jScript macro I recorded to make it easier to Start and Stop the simulation. The jScript Macro Recorder is your friend. :)

Post by Johny // May 2, 2008, 4:18am

Johny
Total Posts: 672
pic
Hello Kena, here I add jscript obj for save or restore your objs matrix. I dont use array for simple and easy for understand and modification by you. but you must see inside ConeA, B, and C, I added Owner name obj (get from System=kernel library). Please examine the link new link from coneA,B and C to SaveorRestore obj for learning. You can manualy add matrix4,5,... and objName4,5,...n if you have more objs.

Kena if you have many objs, please check trueBlue suggestion RsObj Maybe its help with one button click for start you phys animation rather than manualy active timerEvent one by one before run tS phys. ;)

Good Luck! :)

Post by kena // May 2, 2008, 4:41am

kena
Total Posts: 2321
pic
Thank you both! I tried the jscript macro recorder, but it didn't seem to want to work right. but at least it worked for you guys!

I will try these out when I get back from work tonight. :D


P.S. I LOVE these forums! So nice to have such a helpful community.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn