Issues with Character Controller Move

Hi,

I am a Unity newbie and am trying to use Character Controller Move (Unity - Scripting API: CharacterController.Move) script to move my character on a flat terrain. On running the script, I am currently facing two issues:

  1. The character seems to sink through the terrain (It does not do that if I remove “if (controller.isGrounded)” from the code).Do I need to set something to make it work with the check for being grounded?

  2. The character does not seem to move forward at all. It has its legs moving (due to its art animation) but remains at a fixed point. I thought the “controller.Move(moveDirection * Time.deltaTime);” code in the script should make it move but it doesnt. How do I make it walk forward on terrain?

Thanks.

Are you asking for the iphone or unity itself?
That script controller would need you to setup the iphone accelarometer capture during the run loop, stored in a vector3, then determine if you are playing portrate or landscape to decide on which of the vector numbers to use for the movement vs turning.

Thanks. Yes this is for the iphone. This is a javascript so I assume by run loop you mean the update function.

Any pointers on how I can obtain the iphone screen capture?

Also since I am using Unity iphone version, does it mean I will not be able to see the character walk/move in the game screen of Unity?

Thanks.

You can’t mimic (that i know of, someone please correct me if i am wrong) the accelarometere information in unity, i started out by using key press events for my movement, then later replaced that with the accelarometer data and tested with build / run on the iphone itself.

Portrait play vs landscape play uses different accelarometer values, for instance, the vector3 of x,y,z… well the y plane is uses while playing a game in landscape for left and right, and X is forward or backward, not sure what Z is for (technically you only use 2 of the 3 vectors since the iphone only has 2 axis for tilting, where it sits in 3d space is useless)

when playing portrait, you use the x plane for left and right, and the y plane for forward and back.