3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1] 2

Author Topic: Beginner's Tutorial - Script Imposters  (Read 4889 times)

« on: May 16, 2011, 03:52:59 PM »
Now nobody, not even noobs can say they don't know how to make imposters. ;D

Here is a quick tutorial for beginners on how to make 5 imposters.

Just copy this code into a script object, hook the script to the thing you want to imposter, and then follow the written comments.

Code: [Select]
void Main()
{
//Imposters are great because you can clone a skinmesh or rigidbody(only in 3DRad 7.16 or higher) and allow your game to run at a faster frames per second.

//This is how to create 5 imposters when the project starts.

if(iInitializing())
iObjectImpostersCreate(OBJ_0,5);









//This is how to change the imposters' locations.

//We also need an orientation to use. Let's call it q and set it's angle to 0,0,0.

//You should take line 24 and put it above the "void Main()" just to keep things organized, but it will work the way it is anyway, so it's not neccessary.

Quaternion q;
iQuaternionFromEulerAngles(q,0,0,0,"xyz");







//This is the part that sets the different imposters' positions.

//The Vector3(0,0,0) part is where you get to choose where to put the imposter by specifying x,y,z locations.

//Don't forget to write the full number. 0.01 will work and .01 will not work.

iObjectImposterSet(OBJ_0,0,q,Vector3(1,2,3));  //This is for imposter #0
iObjectImposterSet(OBJ_0,1,q,Vector3(2,3,1));  //This is for imposter #1
iObjectImposterSet(OBJ_0,2,q,Vector3(3,2,1));  //This is for imposter #2
iObjectImposterSet(OBJ_0,3,q,Vector3(3,1,2));  //This is for imposter #3
iObjectImposterSet(OBJ_0,4,q,Vector3(2,1,3));  //This is for imposter #4

//That's all 5 imposters.

//Now that you understand how to work the script, you can delete all the messages that have the // in front of them.


}
« Last Edit: May 18, 2011, 09:58:49 AM by Rush3Fan »
« Reply #1 on: May 16, 2011, 04:07:31 PM »
Here is just the plain undocumented script. Don't worry about giving me credit or anything..
Code: [Select]
Quaternion q;
void Main()
{
if(iInitializing())
iObjectImpostersCreate(OBJ_0,5);
iQuaternionFromEulerAngles(q,0,0,0,"xyz");
iObjectImposterSet(OBJ_0,0,q,Vector3(0,0,0));
iObjectImposterSet(OBJ_0,1,q,Vector3(0,0,0));
iObjectImposterSet(OBJ_0,2,q,Vector3(0,0,0));
iObjectImposterSet(OBJ_0,3,q,Vector3(0,0,0));
iObjectImposterSet(OBJ_0,4,q,Vector3(0,0,0));
}
« Reply #2 on: May 16, 2011, 10:40:59 PM »
Hey, Rush3Fan.

It's pretty simple. Thanks.  :)
« Reply #3 on: May 18, 2011, 08:41:41 AM »
i cant make it copy anything? it just not working :-[
airplane...
« Reply #4 on: May 18, 2011, 09:39:43 AM »
Did you connect the script to a skinmesh?

Did you copy and paste the entire script?

Also notice if you are using the undocumented script, all the locations are set to 0,0,0 by defult. Try putting in non zero numbers.
« Reply #5 on: May 18, 2011, 11:38:02 AM »
i attached the script to the water shader skin mesh
i copied the whole thing in the box and pasted it in the script then clicked ok
and i dont see any changes
airplane...
« Reply #6 on: May 18, 2011, 12:34:06 PM »
You have to link the skinmesh to the script for it to work. After they are connected, your skinmesh will show up in the script labeled as OBJ_0.

It might be best to use the fish skinmesh so it's easier to see it working.
« Reply #7 on: May 18, 2011, 12:37:06 PM »
Also, are you copying the code from my first post?

11Dogs

« Reply #8 on: May 30, 2011, 08:04:24 AM »
Looks great! I almost missed this one :o
« Reply #9 on: June 28, 2011, 03:02:14 PM »
WOW! I can't believe that!
I am so stupid! I literally sat here for 10 minutes! Trying to figure out why it is not working. then when I clicked "check Script" I realized I didn't copy the closing bracket for void Main()
« Reply #10 on: June 28, 2011, 08:44:59 PM »
I wasn't too much better when I first started out. :D
« Reply #11 on: May 15, 2012, 11:05:55 AM »
This might sound really stupid, but what is an imposter? I mean what does it do?
New 3DFoundry:3DFoundry.tk

GTGwalkthroughs

« Reply #12 on: May 15, 2012, 11:16:48 AM »
It creates a run-time clone of an object so that your game runs faster...
« Reply #13 on: May 15, 2012, 11:20:50 AM »
nice contribution to the community Rush...

--Mike
« Reply #14 on: May 15, 2012, 11:58:30 AM »
It creates a run-time clone of an object so that your game runs faster...

So it makes a copy of another object (just skinmeshes?).
New 3DFoundry:3DFoundry.tk
Pages: [1] 2