Hi !
I'm making a 2D game in which the player can jump on bumpers that will propel him along the up axis of the bumper.
My bumper is a mushroom and must be rotated at -90 degrees on the Z axis, then, the green axis is horizontal and the red axis is vertical.
Vector2 t = transform.right*-1;// *(-1) because of the -90° rotation on the Z axis, it's my up axis
GameObject.Find ("Jairaum").GetComponent().AddRelativeForce(t * jumpForce);
This code is attached to my bumper and is activated with a collision trigger.
It works very well when the bumper is -90° rotated on the Z axis but when I want to move it around (say I want my up axis coming toward my character so the bumber repels him) it doesn't work very well and isn't smooth at all.
Can somebody help please ?
↧