Mentions légales du service

Skip to content
Snippets Groups Projects
Commit cdaa6592 authored by Fabien Grzeskowiak's avatar Fabien Grzeskowiak
Browse files

add rigid body on the fly

parent 574540e0
No related branches found
No related tags found
No related merge requests found
fileFormatVersion: 2
guid: acbd5d656e4d14747a830df46c5645d4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: eb9404b6e9f35d652ba5ac3ee4cbe322
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
......@@ -167,16 +167,24 @@ public class CrowdBotSimTrial : MonoBehaviour, TrialManager {
GameObject currentAgentGameObject = (GameObject)GameObject.Instantiate(agentModels[index]);
currentAgentGameObject.name = j.ToString() + " - " + currentAgentGameObject.name;
currentAgentGameObject.GetComponent<Collider>().enabled = true;
currentAgentGameObject.AddComponent<Rigidbody>();
Rigidbody rb = currentAgentGameObject.GetComponent<Rigidbody>();
rb.mass = 1;
rb.drag = Mathf.Infinity;
rb.angularDrag = 100;
rb.useGravity = false;
rb.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
crowdController.agent[j] = currentAgentGameObject.GetComponent<Rigidbody>();
crowdPublisher.agent[j] = currentAgentGameObject.GetComponent<Rigidbody>();
crowdController.agent[j] = rb;
crowdPublisher.agent[j] = rb;
currentAgentGameObject.SetActive(true);
TrialRegularAgent a = new TrialRegularAgent();
Agent currentAgent = a.createAgentComponnent(currentAgentGameObject, j + 1);
currentAgentGameObject.tag = "VirtualHumanActive";
agentsList.Add(currentAgent);
currentAgentGameObject.SetActive(true);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment