Hey all, I’ve got a bit of an issue here. I’m trying to add velocity to a gameObject so that after it has been moved it will just slowly come to a stop. I have to do it in C# and C# is a language that I dont have much experience with.
Below is the sample code that I’m using. Essentially, when the code inside “Input.GetMouseButtonUp(0)” is executed, I want velocity to be applied to the gameObject.rigidbody that has been moved.
private Vector3 movement;
protected GameObject pivot;
public override void handleSingleTouch(iPhoneTouch touch)
{
if (!allowDrag) return;
movement = touchMovementVector(touch);
this.startPivot(gameObject.transform.position);
pivot.transform.Translate(movement,Space.World);
if (Input.GetMouseButtonUp(0)) {
gameObject.rigidbody.velocity = new Vector3(0, 10, 0);
}
this.endPivot();
}
As it is, its moving the gameObject 10 for testing sake. Apologies if its something basic that I’m doing wrong, and I would appreciate any help. I have seen another question that is loosely related to my issue, but unfortunately it didnt help me much.
what do you actually want it to do? And what is it doing, I'm a bit hazy on the issue.
– ungalyant2