Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » HELP » Help (General) » align objects on a sphere with the right angle

align objects on a sphere with the right angle

View previous topic View next topic Go down  Message [Page 1 of 1]

Garzec


Member [Lv. 2]
Member [Lv. 2]
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




View user profile

Garzec


Member [Lv. 2]
Member [Lv. 2]
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


View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum