FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.


descriptionalign objects on a sphere with the right angle

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

descriptionRe: align objects on a sphere with the right angle

Just fixed the problem by the following script:


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 ()

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

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