Scripting tutorial

Scripting tutorial

I've been thinking about this a long time, now I am throwing this into the ring. I will take ideas for scripts and then show step by step how to do them (providing they are simple).

Todd
 
Awesome Todd.
So this is how you'd turn a light off in unity javascript:

function Start(){
yield WaitForSeconds(5);
light.enabled=false;
}

That script would be physically attatched to the light object because its accessing a specific component. How would you do this via scripting in Cheetah?

Its not important, Im just curious to see how its done. Usually I'd keyframe this.

Cheers
AaronC
 
in the javascript engine cheetah is using doesn't understand the yeild command. it would be better to just key it for 5 seconds.

right now cheetah doesn't have a way for scripts to be called each frame. for an object to be called each frame it must have some value that changes each frame. I used a value called time, set it to 0 at frame 0 and some other value at the end. its just easier to key frame it
Todd
 
Last edited:
Multiple array xy, yz, or whatever...

I just did a job and I wish I could got multiple array with a random, sequential or control variable, like this example, so I wish control 3 variables x, y and got a random rotate value for each object.
:shock:

Well it's and idea or maybe something for the wish list?
 

Attachments

  • random1.jpg
    random1.jpg
    133 KB · Views: 1,265
  • randoma.jpg
    randoma.jpg
    97.4 KB · Views: 1,278
  • randomb.jpg
    randomb.jpg
    103.2 KB · Views: 1,269
  • random2b.jpg
    random2b.jpg
    62 KB · Views: 1,268
  • randomclient.jpg
    randomclient.jpg
    104.2 KB · Views: 1,259
There's a script which produces different arrays of objects:

http://www.cheetah3d.de/forum/showthread.php?t=2413

This script could be modified to allow you to randomly change different properties of the instances (e.g. allow you to set minimum and maximum deltas for X, Y, Z, H, P, B, and multipliers for Scale X, Y, Z).

A more complex modification could let you use the script as a vegetation generator :)
 
Oops, I got some bugs with the script:shock:
First, thanks for the scirpt tip, but see the image.

Maybe this could help me to learn something about scripts on Cheetah3D

Regards
 

Attachments

  • oops.png
    oops.png
    84.5 KB · Views: 1,231
I was going to point that script out, but it only does part of what he wants. it does it thing by putting several objects inside the parent and then it arranges them according to the layout chosen. he desires one object repeated in the layout. this is supposed to be a tutorial, I will start from scratch and explain it step by step. I am working on it now, will post it soon.

Todd
 
Hi, Todd

nice thread. it will be help to understand how it work. :)

> javiersc

about that error. it is a Polygon script, so you have to place it into /Users/(your account)/Library/Application Support/Cheetah3D/scripts/Polygonobj folder. please check it.

there are 5 different type of script. it has to be placed in certain folder to work.

http://www.cheetah3d.de/forum/showthread.php?t=1577#7

and please check another type of Array script. it may help you.

Polygon Array.js : http://www.cheetah3d.de/forum/showthread.php?t=1731&
Point Array.js : http://www.cheetah3d.de/forum/showthread.php?t=970
Random Array.js : http://www.cheetah3d.de/forum/showthread.php?t=467

regards.

tg_jp, Hiroto
 
Hi Todd, this is kind of a feature request as much as a request for tutorial explanations: You know your Centre.js script? I would be a nice addition if it had a means by which you could select an empty "Polygon Object" as a point to centre around. At present the centre script applys the centre to the logical centre, but if we could centre around an abitary position, we could essentially create pivot points.

What do you think..?
AaronC
 
I want an importer and exporter script...

I play the sims 2 and the 3d meshes
are all in one file the extension is .package is there a way i can import 3d meshes from it into C3D?
 
Thanks Hiroto and Toods

Hi, Todd

nice thread. it will be help to understand how it work. :)

> javiersc

about that error. it is a Polygon script, so you have to place it into /Users/(your account)/Library/Application Support/Cheetah3D/scripts/Polygonobj folder. please check it.

there are 5 different type of script. it has to be placed in certain folder to work.

http://www.cheetah3d.de/forum/showthread.php?t=1577#7

and please check another type of Array script. it may help you.

Polygon Array.js : http://www.cheetah3d.de/forum/showthread.php?t=1731&
Point Array.js : http://www.cheetah3d.de/forum/showthread.php?t=970
Random Array.js : http://www.cheetah3d.de/forum/showthread.php?t=467

regards.

tg_jp, Hiroto

I visit your page a lot and you got great and utility script ideas, I change the script on the other carpet and works great, I work with your other scripts, but not have more time on these days.

Tood, I believe you got a lot of work, hope that you can upload the tutorial soon.

I just want to say thanks to all, because I like the way this forum work with a lot of comments and people try to rich and collaborate with others.

And the search area works great on the forums, sometimes I just don't got much time to read and visit all the links spread all over the place. On the other hand Martin always got time to see and read all threads, not many times we got the change to keep contact form the developers from other softwares and I believe it's some kind of apple phenomena user only.

Any way Is the first time I got the change to got a scriptable software.
 
Back
Top