UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionalign objects on a sphere with the right angle  Emptyalign objects on a sphere with the right angle

more_horiz
Hey, im working on a sphere as a planet. I created some trees in blender and gave them a mesh collider. When i want to place these trees on the sphere, they are not placed correctly because the sphere is like a ball .. obviously .. How can i make Unity place the trees in the right angle? When the tree is placed on the east side it has to be a angle of 90 to the sphere. just posting a picture of my issue

align objects on a sphere with the right angle  Gsdfgs10


descriptionalign objects on a sphere with the right angle  EmptyRe: align objects on a sphere with the right angle

more_horiz
Just fixed the problem by the following script:

Code:


using UnityEngine;
using System.Collections;
[RequireComponent (typeof (Rigidbody))]
public class GravityBody : MonoBehaviour {
    GravityAttractor planet;
    void Awake()
    {
            planet = GameObject.FindGameObjectWithTag("Planet").GetComponent<GravityAttractor>();
            GetComponent<Rigidbody>().useGravity = false;
            GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
    }
    void FixedUpdate ()
    {
            planet.Attract(transform);
    }
}


My questions for now are, which collider is the right one for an static object like a tree. You should not be able to walk through a tree, but a box collider or capsule collider is not the right one because of placing a bareer over it.

My next question is, the tree is rotated on his backside and then pulled on the sphere, you can watch this on the picture

align objects on a sphere with the right angle  Gsdfgs11
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply