Ok, I’m trying to create a simple script that detects my character’s y against a set water level and turns off gravity when <=. I plan on expanding on it in the future, but right now my biggest hangup is just taking control of the built in CharacterMotor in the First Person Controller that comes with Unity. I’ve done a bit of research and know I’m supposed to be able to pull this in by using GetComponent(CharacterMotor). Only one problem though… where the hell is CharacterMotor?? Mono doesn’t list it in the intellitype drop down, I instead see CharacterController, CharacterInfo, and CharacterJoint, but no CharacterMotor. If I forcefully enter this, I get BCE0005: Unknown identifier: ‘CharacterMotor’. I see that it exists in Sources/Scripts under the Character Controller folder, and I even see it attached to the prefab I dragged onto my scene…
Here’s my code, now admittedly it’s BOO script, however I’ve tried the same thing in JS and I get the exact same problem, nothing can find CharacterMotor:
import UnityEngine
class Swim (MonoBehaviour):
public waterlevel as double
private character as GameObject
def Start ():
character = GameObject.Find("First Person Controller")
chMotor = character.GetComponent(CharacterMotor)
def Update ():
if character.transform.position.y <= waterlevel:
chMotor.Movement.Gravity = 0
else:
chMotor.Movement.Gravity = 20
What am I doing wrong here?
Can you post screenshot evidence that a CharacterMotor file is in your project?
– flaviusxvii[19300-charactermotorconfirm.png|19300]
– wyt3dr4g0nI should also note that I tried doing this in a new project too just to see if something may have imported funky in the original, same problem. I also get this on a different computer as well. So I'm pretty sure it's just something I'm not doing right.
– wyt3dr4g0n