How do you make it so that your; car, tank, plane etc. can fall apart into multiple peices? Do you use joints or something?
This forum is now archived!
- Welcome to the archive!
News:
The 3DRad community can be found at classdev.net.
- 3D Rad - Free 3D game maker - Forum >
- General Category >
- 3D Rad - Artist's Discussion Forum >
- Totally destructable objects
Author Topic: Totally destructable objects (Read 2226 times)
if you were willing to script you could use a child offset function to hold the disabled body piece in place untill to you were ready for it to fall off. would save on joints at least and those body pieces wouldn't need to be enabled until then either. haven't tested that out in rad but might be worth a try .
1st step: ask the geneious what a "child offset function" is...That is the second step. The first step is to learn to be able to write code independently. First step seems so far away.......
Yea, what is this child offset function? Possibly the iObjectBone functions?
Akz251: Scripting is fun and easy. Just print out a Script Object Reference booklet and you'll become a pro in no time.
You can find it in the script object help file or in the documentation somewhere.
Akz251: Scripting is fun and easy. Just print out a Script Object Reference booklet and you'll become a pro in no time.
You can find it in the script object help file or in the documentation somewhere.
well, you see, Main() went and had a child with iObjectStart() and the Child was born!
hope you all get my humour...
hope you all get my humour...
below are 2 child functions.
the first is used if you just want to place a object at an offset position relative to the parent object.
the second is like the first except it automatically orientates the child to the parents orientation.
parent is your parent object
child is the object you want to attach
Offset is a location to place the child relative to the parent
hope that helps abit.
Code: [Select]
//******************************************************************
//FUNCTIONS - PARENT CHILD OFFSET
//******************************************************************
void ObjectParentObjectChildOffset(int Parent,int Child,Vector3 Offset)
{
//---------------------------------------------------------------
Vector3 parent_loc;
Vector3 real_offset;
Vector3 child_loc;
Quaternion parent_rot;
iObjectLocation(Parent,parent_loc);
iObjectOrientation(Parent,parent_rot);
iVectorRotate(real_offset,Offset,parent_rot);
child_loc.x = parent_loc.x + real_offset.x;
child_loc.y = parent_loc.y + real_offset.y;
child_loc.z = parent_loc.z + real_offset.z;
iObjectLocationSet(Child,child_loc);
//---------------------------------------------------------------
}
Code: [Select]
//******************************************************************
//FUNCTIONS - PARENT CHILD OFFSET - ORIENTATE CHILD TO PARENT
//******************************************************************
void ObjectParentObjectChildOffset_OrientateChild(int Parent,int Child,Vector3 Offset)
{
//---------------------------------------------------------------
Vector3 parent_loc;
Vector3 real_offset;
Vector3 child_loc;
Quaternion parent_rot;
iObjectLocation(Parent,parent_loc);
iObjectOrientation(Parent,parent_rot);
iVectorRotate(real_offset,Offset,parent_rot);
child_loc.x = parent_loc.x + real_offset.x;
child_loc.y = parent_loc.y + real_offset.y;
child_loc.z = parent_loc.z + real_offset.z;
iObjectLocationSet(Child,child_loc);
iObjectOrientationSet(Child,parent_rot);
//---------------------------------------------------------------
}
usage:
place either function below main in a script.
then you can call it in main like...
Code: [Select]
ObjectParentObjectChildOffset(OBJ_0,OBJ_22,Vector3(0.0f,1.0f,0.0f));//or whatever vector3 position you want
that will make OBJ_22 position 1 meter above it's parent OBJ_0, but you can set the vector3 to any position and the child will always
hold on to that offset.
K, I don't get it.. I could totally change the code and make something work, but I don't see the point in deleting parts of your script. Could you modify this project showing how this script should be linked to the objects please? Maybe I could learn a bit about the organization you used in the beginning of the script...
attached a modified version of what you posted with a part that breaks away.
Edit: Press space to detatch part.
in yours you put the whole function in the main loop but it goes below the main loop and you make calls to it from the main. it'll make sence when you try the demo.
Edit: Press space to detatch part.
in yours you put the whole function in the main loop but it goes below the main loop and you make calls to it from the main. it'll make sence when you try the demo.
Pages: [1] 2