// Use this for initialization void Start() { fix = gameObject.AddComponent<LPFixturePoly>(); fix.DefinePoints(Points); bod = GetComponent<LPBody>(); bod.Initialise(FindObjectOfType<LPManager>()); }
// Use this for initialization void Start() { fix = gameObject.AddComponent <LPFixturePoly>(); fix.DefinePoints(Points); bod = GetComponent <LPBody>(); bod.Initialise(FindObjectOfType <LPManager>()); }
protected override void DoSpawn() { GameObject ob = Instantiate(Prefab, transform.position, Quaternion.AngleAxis(Random.Range(0f, 360f), Vector3.back)) as GameObject; LPBody bod = ob.GetComponent <LPBody>(); bod.Initialise(lpman); Vector3 diff = getdiff(); LPAPIBody.ApplyLinearImpulseToBody(bod.GetPtr(), diff.x, diff.y, ob.transform.position.x, ob.transform.position.y, true); }
void MakeChainFix() { //Add an LPFixtureChainShape to the gameobject (LPBody is required so is added automatically) LPFixtureChainShape fix = ChainFix.AddComponent <LPFixtureChainShape>(); //Call DefinePoints to set the polys points programmatically fix.DefinePoints(Points); //Set up the body how we want LPBody bod = ChainFix.GetComponent <LPBody>(); bod.BodyType = LPBodyTypes.Dynamic; //Call initialise on the LPBody component passing in the LPManager component bod.Initialise(FindObjectOfType <LPManager>()); }
private IEnumerator Spawn() { while (true) { if (bodylist.Count > amount) { bodylist[0].Delete(); bodylist.RemoveAt(0); } GameObject go = new GameObject("body"); go.transform.parent = transform; go.transform.position = transform.position; LPBody body = go.AddComponent <LPBody>(); bodylist.Add(body); LPFixtureCircle circle = go.AddComponent <LPFixtureCircle>(); circle.Density = 0.2f; circle.Radius = 0.1f; body.BodyType = LPBodyTypes.Dynamic; body.Initialise(lpman); LPAPIBody.ApplyForceToCentreOfBody(body.GetPtr(), SpawnVelocity.x, SpawnVelocity.y); yield return(new WaitForSeconds(spawninterval)); } }