Hello!I’m new to Unity and i would like to know how can i make my “Character” to climb up a ledder.(I’m using JavaScript).But the ideea is that i don’t have a psyhical character…my character is actually,the camera
[/b]
You do have a character - the fact that the camera is attached to it is incidental ![]()
Although I haven’t implemented ‘ladder climbing’ myself, I imagine it’s most likely going to involve switching between two different ‘movement modes’ based on whether or not the character is ‘on the ladder’.
As far as determining when the character is on the ladder, the first thing I’d try would be a trigger. Create a box or capsule collider that roughly corresponds to the ‘climbable’ area associated with the ladder, and then use the OnTriggerEnter(), OnTriggerStay(), and/or OnTriggerExit() functions to set the player character to the appropriate state (that is, ‘ladder mode’ or ‘normal mode’).
You can get an idea of how ‘ladder mode’ should operate by checking out other games that involve ladder climbing. Typically, mouse look continues to work in the normal way; only linear movement is affected. I think to get the right effect in terms of linear motion, you’ll want to project the ‘normal’ forward motion vector onto the up axis, and use that (possibly scaled to get the right ‘climb speed’) as your movement vector. You’ll probably also want to have jumping switch you from ‘ladder mode’ back to ‘normal mode’.
Getting the effect just right will probably take some tweaking, but the above should at least get you started.