Access Bone with controller - Newbie
Good afternoon all, I am a beginner in Unity3D and I was writing a code on how to control the rotation of a bone which is here my upper leg left.
I need to do this to create a mechatronic simulation of an exoskeleton and I am not sure at all about the writing: using System.Collections; using System.Collections.Generic; using UnityEngine;
public class CharacterController : MonoBehaviour
{
//first test for the upper leg: the objective is to control the rotation of the upper leg with a keyboard value for the rotation
// around the x-axis.
public float speed = 10.0F;
public float rotationSpeed = 0.01F;
public Vector3 myvector = Vector3.zero;
public GameObject player;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void ModifyAngle()
{
GameObject UpperLeg = GameObject.Find("myHuman/Upper_Leg_L");
float rotationX = Input.GetAxis("Horizontal") * rotationSpeed;
rotationX *= Time.deltaTime;
transform.Rotate(0, rotationX, 0);
}
}
So the code runs but the scene I get is very much wierd ( see for yourself).![alt text][1] It seems my character is sitting in the shadow of realm waiting for me to develop some skills in unity3D lmfao
![alt text][2]
Does anyone have any idea on how i could improve my code? I have a hard time imagining what i can put in the update method.
thanks for your time ^^ [1]: /storage/temp/118371-sans-titre.png [2]: /storage/temp/118372-sans-titre2.jpg
Your answer
Follow this Question
Related Questions
Mario kart controller physics 0 Answers
Crouch Script Issue 0 Answers
OnClick change Animator & Sprite Renderer 2 Answers
Car Controller script? 0 Answers
Jump problem animation 0 Answers