Hello, I’m making a 2d platform game and my player’s momentum is having problems. When I jump on a moving platform going up/right/left my character shoots in the direction the platform was going in much farther than a regular jump and he does not start falling down for a long time. Any help would be very appreciated.
I actually don’t know what a physics walker script is… but I’m using the platform controller script from the 2DGameplayTutorialProject in the walkthrough. I found that applying a rigidbody component to the character and setting both drags to 30 helps, but It’s only a temporary fix. Is there anything that can fix this for good?
`class PlatformerControllerJumping {
// Can the character jump?
var enabled = true;
// How high do we jump when pressing jump and letting go immediately
var height = 1.0;
// We add extraHeight units (meters) on top when holding the button down longer while jumping
var extraHeight = 4.1;
// This prevents inordinarily too quick jumping
// The next line, @System.NonSerialized , tells Unity to not serialize the variable or show it in the inspector view. Very handy for organization!
@System.NonSerialized
var repeatTime = 0.05;
@System.NonSerialized
var timeout = 0.15;
// Are we jumping? (Initiated with jump button and not grounded yet)
@System.NonSerialized
var jumping = false;
@System.NonSerialized
var reachedApex = false;
// Last time the jump button was clicked down
@System.NonSerialized
var lastButtonTime = -10.0;
// Last time we performed a jump
@System.NonSerialized
var lastTime = -1.0;
// the height we jumped from (Used to determine for how long to apply extra jump power after jumping.)
@System.NonSerialized
var lastStartHeight = 0.0;
}
var jump : PlatformerControllerJumping;
private var controller : CharacterController;
// Moving platform support.
private var activePlatform : Transform;
private var activeLocalPlatformPoint : Vector3;
private var activeGlobalPlatformPoint : Vector3;
private var lastPlatformVelocity : Vector3;
// This is used to keep track of special effects in UpdateEffects ();
private var areEmittersOn = false;