Instantiate problem!! - spawn point moves down over time

I’ve been trying to fix this problem for some time without success. My prefabbed object somehow instantiates below the designated spawn point (launch position) every time the instantiate code is called. Over a short period of time, the prefab will drop continously toward the ground while the launch position remains the same. My instantiate code is as such:

var instantball : Rigidbody; 
var xVel : float=0; 
var yVel : float=0; 
var zVel : float=0 

shotball = Instantiate(instantball, transform.position, transform.rotation); 
Physics.IgnoreCollision(instantball.collider,transform.root.collider); 
instantball.velocity = transform.TransformDirection (xVel, yVel, zVel);

I assign xVel, yVel, and zVel within my code and the code is attached to a child (launchposition) game object of my third person player. My prefab has gravity applied to its rigidbody and also has a constant force applied to the Y direction.

At this point, I have no idea why the location of the instantiated prefab continues to move. Any help on this matter would be greatly appreciated.

Thanks

A shot in the dark here,

Could it be that you’re cloning an object already in the scene (complete with current velocity and such) instead of a prefab from the assets list?

Hum,

Thanks for the reply. The clone object exists only once in the scene.

Maybe I am not considering something in the instantiate code. Does instantiate pull gravity/velocity information (or reference transform values) from previously instantiated prefabs? Does gravity on a prefabbed object have an effect even when the object is not instantiated?

Hum,

Thanks for the reply. The clone object exists only once in the scene.

Maybe I am not considering something in the instantiate code. Does instantiate pull gravity/velocity information (or reference transform values) from previously instantiated prefabs? Does gravity on a prefabbed object have an effect even when the object is not instantiated?

try creating a new prefab in the project view then recreate the object you want to instantiate and drag it into the new prefab, name the prefab then __delete it in the hierarchy__and apply the new prefab to the object using your script in the ispector window. that should fix it i think

Use the Inspector and the Pause function in the Editor to view what the Rigidbody and Constant Force look like after your prefab is instantiated. You should see the MyPlayer(Clone) object in the scene hierarchy when it is first instantiated; just pause quickly and see what forces are acting upon the rigidbody. It sounds like gravity alone is at work…or otherwise winning the battle against the ConstantForce.

[EDIT]

Negative. If you are indeed instantiating the prefab itself. Posting your instantiate code may help.

Thanks Bored Homeless. I will try your suggestions this evening. Bored, this is my problem code:

var instantball : Rigidbody; 
var xVel : float=0; 
var yVel : float=0; 
var zVel : float=0 

shotball = Instantiate(instantball, transform.position, transform.rotation); 
Physics.IgnoreCollision(instantball.collider,transform.root.collider); 
instantball.velocity = transform.TransformDirection (xVel, yVel, zVel);

I did attempt to pause and watch, frame by frame, what was going on with the instantiate. The spawn point never moves, but with each instantiate, the prefab would originate slightly lower than the spawn point until it was no longer close. I have no idea why the instantiate origin would move.