public void AppendNote(string text, Vector3 o, Face feature) { btSoftBody_appendNote(_native, text, ref o, feature._native); }
protected override void OnHandleInput() { base.OnHandleInput(); if (Input.MousePressed == MouseButtons.Right) { results.Fraction = 1; if (pickConstraint == null) { Vector3 rayFrom = Freelook.Eye; Vector3 rayTo = GetRayTo(Input.MousePoint, Freelook.Eye, Freelook.Target, FieldOfView); Vector3 rayDir = (rayTo - rayFrom); rayDir.Normalize(); AlignedSoftBodyArray sbs = ((SoftRigidDynamicsWorld)PhysicsContext.World).SoftBodyArray; for (int ib = 0; ib < sbs.Count; ++ib) { SoftBody psb = sbs[ib]; SRayCast res = new SRayCast(); if (psb.RayTest(rayFrom, rayTo, res)) { results = res; } } if (results.Fraction < 1) { impact = rayFrom + (rayTo - rayFrom) * results.Fraction; drag = !(PhysicsContext as Physics).cutting; lastMousePos = Input.MousePoint; node = null; switch (results.Feature) { case EFeature.Tetra: { Tetra tet = results.Body.Tetras[results.Index]; node = tet.Nodes[0]; for (int i = 1; i < 4; ++i) { if ((node.X - impact).LengthSquared() > (tet.Nodes[i].X - impact).LengthSquared()) { node = tet.Nodes[i]; } } break; } case EFeature.Face: { Face f = results.Body.Faces[results.Index]; node = f.N[0]; for (int i = 1; i < 3; ++i) { if ((node.X - impact).LengthSquared() > (f.N[i].X - impact).LengthSquared()) { node = f.N[i]; } } } break; } if (node != null) { goal = node.X; } //return; } } } else if (Input.MouseReleased == MouseButtons.Right) { if ((!drag) && (PhysicsContext as Physics).cutting && (results.Fraction < 1)) { ImplicitSphere isphere = new ImplicitSphere(impact, 1); results.Body.Refine(isphere, 0.0001f, true); } results.Fraction = 1; drag = false; } // Mouse movement if (Input.MouseDown == MouseButtons.Right) { if (node != null && (results.Fraction < 1)) { if (!drag) { int x = Input.MousePoint.X - lastMousePos.X; int y = Input.MousePoint.Y - lastMousePos.Y; if ((x * x) + (y * y) > 6) { drag = true; } } if (drag) { lastMousePos = Input.MousePoint; } } } (PhysicsContext as Physics).HandleInput(Input, FrameDelta); }