J'ai découvert ce léger problème:
Avec ce script,je rajouter un Rigidbody à un objet dont les positions sont freezées:
Code : Tout sélectionner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class add_rigidbody : MonoBehaviour
{
public GameObject obj;
Rigidbody rigid;
// Start is called before the first frame update
void Start()
{
rigid = obj.AddComponent<Rigidbody>();
rigid.constraints = RigidbodyConstraints.FreezePosition;
rigid.useGravity=false;
}
}
Code : Tout sélectionner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class add_rigidbody : MonoBehaviour
{
public GameObject obj;
Rigidbody rigid;
// Start is called before the first frame update
void Start()
{
rigid = obj.AddComponent<Rigidbody>();
rigid.constraints = RigidbodyConstraints.FreezeRotation;
rigid.useGravity=false;
}
}
Code : Tout sélectionner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class add_rigidbody : MonoBehaviour
{
public GameObject obj;
Rigidbody rigid;
// Start is called before the first frame update
void Start()
{
rigid = obj.AddComponent<Rigidbody>();
rigid.constraints = RigidbodyConstraints.FreezePosition;
rigid.constraints = RigidbodyConstraints.FreezeRotation;
rigid.useGravity=false;
}
}
Que faut-il corriger pour ajouter à un objet un Rigidbody dont les positions ET rotations sont freezées?
merci de votre aide