|
Post by commended on Dec 28, 2016 16:09:16 GMT
So my Skinmesh is attached to a Rigibody, the projectile is shooting whilst following the path HOWEVER the Projectile will not rotate with the skinmesh? Please help...
|
|
|
Post by Karvy on Dec 28, 2016 16:53:31 GMT
You should try this.. add a script, attach your skinmesh and then your projectile, and add this jestermon's localtoparent function to it void LocalToParent(int PARENT, int OBJ, Vector3 rotation, Vector3 translation)
{
Vector3 parentLocation;
Quaternion parentOrientation;
Quaternion newOrientation;
Quaternion objectOrientation;
Vector3 forward, location, newLocation;
float x,y,z,ud,lr,fb;
x = rotation.x; y = rotation.y; z = rotation.z;
fb = translation.z; lr = translation.x; ud = translation.y;
iObjectLocation(PARENT, parentLocation);
iObjectOrientation(PARENT,parentOrientation);
iObjectOrientationSet(OBJ,parentOrientation);
iVectorRotate(forward,Vector3(lr,ud,fb),parentOrientation);
newLocation = parentLocation + forward;
iObjectLocationSet(OBJ,newLocation);
iQuaternionFromEulerAngles(newOrientation,x,y,z,"xyz");
iQuaternionMultiply(newOrientation,newOrientation,parentOrientation);
iObjectOrientationSet(OBJ,newOrientation);
}
void Main() { LocalToParent(OBJ_0,OBJ_22,Vector3(0,0,0),Vector3(0,0,0)) ; }
|
|
|
Post by Power Supersport on Dec 28, 2016 17:00:19 GMT
Is your skinmesh set as parent in the projectile window? If so, you can use a simple script to set the orientation of the projectile the same as the skinmesh...
Quaternion Orientation; void Main () { iObjectOrientation (OBJ_0, Orientation); iObjectOrientationSet (OBJ_22, Orientation); } OBJ_0 is your skinmesh, OBJ_22 is your projectile...
|
|
|
Post by commended on Dec 28, 2016 17:31:55 GMT
|
|
|
Post by TinSoldier on Dec 28, 2016 21:04:08 GMT
i'm not following what your problem is ?
The normal process here is a skinmesh is attached to a rigidbody then it follows the rigidbody. Same goes for the projectile.
You seem to be expecting the reverse.. the projectile to follow the skinmesh ? the projectile follows the rigidbody and its rotations, not the skinmesh's...
A skinmesh is designed to be a visual aspect and the rigidbody is the physical parts that interact in the 3D world. The rigidbody does have a visual part as well and you only need to add a skinmesh if you want the extra and better looks & effects that skinmesh's give you, like animations and lighting.
I think you may need to re-think how you expect your objects to work.. or supply more detail for what your trying to do...
|
|