- Home /
Movement script breaks colliders
Hi I augmented the character controller with this(in another c# file) It adds vertical movement but when my player object hits a collider whilst moving in this way it just travels straight through. Can anyone tell me why this is please?
void playerHoverMovement(){
if(Input.GetAxis("upDown") >= 0){
this.transform.Translate(new Vector3(0,Input.GetAxis("upDown"),0)
* Time.deltaTime
* verticalMoveSpeed
* OceanBox.isBelowOceanFloor(oceanBox.playerTransform),
Space.World);
}
if(Input.GetAxis("downUp") >= 0 /*&& !isAtLevelBounds()*/){
this.transform.Translate(new Vector3(0,-Input.GetAxis("downUp"),0)
* Time.deltaTime
* verticalMoveSpeed
* OceanBox.isAboveOceanFloor(oceanBox.playerTransform),
Space.World);
}
}
use transform.TransformDirection ins$$anonymous$$d of translate. give it a try
Can you please give me an example of how to implement that as it does nothing by swapping out the commands :(
http://docs.unity3d.com/Documentation/ScriptReference/CharacterController.$$anonymous$$ove.html
check the example there in the doc
controller.$$anonymous$$ove is the one that moves the char in the example. move works with a vector3 which is represented as the variable moveDirection. that gets the input axes
Answer by Mander · Oct 09, 2012 at 06:08 PM
check the example there in the doc to use the CharacterController
controller.Move is the one that moves the char in the example. move works with a vector3 which is represented as the variable moveDirection. that gets the input axes
Your answer
Follow this Question
Related Questions
How to limit the forces applied to an object to just forward, left, and right? 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
A simple solution for constant rigidbody movement without changing and clamping velocity directly 2 Answers
Non slippery movement 1 Answer