- Home /
How do i use animated Objects as a player?
Hello,
I am pretty new to Unity and am currently trying to move my "Player".
But it won't move at all, the only thing that worked was turning it using transform.Rotate().
I guess it has something to do with what my "Player" is made of.
Right now i somewhat made a Voxel-like charakter like the Charackters out of the game "Trove" completely out of cubes in Unity, because i don't know how to use 3D modelling-programmes. And i even already animated it (idle, walking...).
So it consists out of a lot of animated 3D Objects. The Basic Group (My Character) containing the Bodyparts has attached the Transformer, an Animation Handler, the Character Controller, and the Controller Script. Each bodypart just has the Transformer, and the individuel cubes each have the Transformer, the Mesh Filter, The Box Collider and the Mesh Renderer.
After much trial and error i applied the most basic movement i could find and it still won't work... so i applied the same script to a capsule and it works totally fine...
Is the whole way i am doing this wrong and i should use something like Blender or am i just missing something?
For those who want to look at it closer i attach My Assets containing my "Player" the Scene and everything else vital.
PS: I'am german so sorry for my probably bad english :D
Edit: I applied a new scirpt only containing the basic movement code mentioned in my comment below, now my Character moves only up, does anyone know why? Then i made a new Character containing 3 capsules, applied the basic movement script, and even animated it, no Problems at all... tried the same using 2 cubes... it moves for like 1 sec and then gets stuck or it can only jump. Does the Character Controller have some problems with cubes or what?
Answer by erlo68 · Mar 06, 2015 at 05:55 PM
OK i found a solution.
I read that "roughe collider" cause the character controller to try to climb over itself, so i just had to remove all the colliders! :)
Answer by toddisarockstar · Feb 24, 2015 at 07:04 AM
you need to put your movement script in your question. so we can see if that is the problem. it is possible for animation positions to override world positions if you dont have a proper parent assigned to move the group, but my guess is that the problem is in your script.
and btw way, i am super impressed that you actually did this without a 3d program!
3d max is the best. if you cant get 3dmax going then get Blender!
it way easier after you take the time to learn them. they are way faster and you can do so much more!
unity is an exelently designed game engine. the more i learn the more i know the sky is the limit! but whatever you figured out with unity to make caracters is a waste. you will find out soon that it just doesnt do everything you need to do with creating characters.
take the time to learn blender or 3dmax instead!
Oh thx, but if you only use cubes with coordinates it is pretty easy to do something like this ^^
This is the Basic code working for the Capsule but not for my Player:
if (_characterController.isGrounded)
{
moveDirection = new Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if(Input.GetButton("Jump"))
{
moveDirection.y = jumpSpeed;
}
}
moveDirection.y -= gravity * Time.deltaTime;
_characterController.$$anonymous$$ove (moveDirection * Time.deltaTime);
It won't let me Upload my Player_Controller.cs, so if you want to see the full code you need to download $$anonymous$$y Assets linked in my question and search for the Player_Controller.cs.
Hope this will help :)
And i will definitely consider learning how to use a 3D-$$anonymous$$oddeling software ^^
But the main reason was to make animations that "construct the player" out of its parts when spawning and deconstruct him on death but in the way as if the connections between the parts will simply vanish on death and the parts can be thrown around individually, and i don't know if this will work if i make my Player as a "complete" structure.