/** * Access the user object of collision object A, provided it's a Spatial. * * @return the pre-existing Spatial, or null if none */ public Spatial getNodeA() { if (nodeA.getUserObject() instanceof Spatial) { return (Spatial) nodeA.getUserObject(); } return null; }
/** * @return A Spatial if the UserObject of the PhysicsCollisionObject is a Spatial */ public Spatial getNodeA() { if (nodeA.getUserObject() instanceof Spatial) { return (Spatial) nodeA.getUserObject(); } return null; }
/** * Access the user object of collision object B, provided it's a Spatial. * * @return the pre-existing Spatial, or null if none */ public Spatial getNodeB() { if (nodeB.getUserObject() instanceof Spatial) { return (Spatial) nodeB.getUserObject(); } return null; }
/** * @return A Spatial if the UserObject of the PhysicsCollisionObject is a Spatial */ public Spatial getNodeB() { if (nodeB.getUserObject() instanceof Spatial) { return (Spatial) nodeB.getUserObject(); } return null; }
public void collide(Bone bone, PhysicsCollisionObject object, PhysicsCollisionEvent event) { if (object.getUserObject() != null && object.getUserObject() instanceof Geometry) { Geometry geom = (Geometry) object.getUserObject(); if ("Floor".equals(geom.getName())) { return; } } ragdoll.setRagdollMode(); }
if (objA.getUserObject() instanceof PhysicsBoneLink) { PhysicsBoneLink link = (PhysicsBoneLink) objA.getUserObject(); if (link != null) { hit = true; if (objB.getUserObject() instanceof PhysicsBoneLink) { PhysicsBoneLink link = (PhysicsBoneLink) objB.getUserObject(); if (link != null) { hit = true;
if (objA.getUserObject() instanceof PhysicsBoneLink) { PhysicsBoneLink link = (PhysicsBoneLink) objA.getUserObject(); if (link != null) { hit = true; if (objB.getUserObject() instanceof PhysicsBoneLink) { PhysicsBoneLink link = (PhysicsBoneLink) objB.getUserObject(); if (link != null) { hit = true;
@Override public void simpleUpdate(float tpf) { float rayLength = 50f; Vector3f start = cam.getLocation(); Vector3f end = cam.getDirection().scaleAdd(rayLength, start); List<PhysicsRayTestResult> rayTest = bulletAppState.getPhysicsSpace().rayTest(start, end); if (rayTest.size() > 0) { PhysicsRayTestResult get = rayTest.get(0); PhysicsCollisionObject collisionObject = get.getCollisionObject(); // Display the name of the 1st object in place of FPS. fpsText.setText(collisionObject.getUserObject().toString()); } else { // Provide prompt feedback that no collision object was hit. fpsText.setText("MISSING"); } }
@Override public void simpleUpdate(float tpf) { float move = tpf * 1; boolean colliding = false; List<PhysicsSweepTestResult> sweepTest = bulletAppState.getPhysicsSpace().sweepTest(capsuleCollisionShape, new Transform(capsule.getWorldTranslation()), new Transform(capsule.getWorldTranslation().add(dist, 0, 0))); for (PhysicsSweepTestResult result : sweepTest) { if (result.getCollisionObject().getCollisionShape() != capsuleCollisionShape) { PhysicsCollisionObject collisionObject = result.getCollisionObject(); fpsText.setText("Almost colliding with " + collisionObject.getUserObject().toString()); colliding = true; } } if (!colliding) { // if the sweep is clear then move the spatial capsule.move(move, 0, 0); } } }
/** * @return A Spatial if the UserObject of the PhysicsCollisionObject is a Spatial */ public Spatial getNodeB() { if (nodeB.getUserObject() instanceof Spatial) { return (Spatial) nodeB.getUserObject(); } return null; }
/** * @return A Spatial if the UserObject of the PhysicsCollisionObject is a Spatial */ public Spatial getNodeA() { if (nodeA.getUserObject() instanceof Spatial) { return (Spatial) nodeA.getUserObject(); } return null; }
/** * @return A Spatial if the UserObject of the PhysicsCollisionObject is a Spatial */ public Spatial getNodeB() { if (nodeB.getUserObject() instanceof Spatial) { return (Spatial) nodeB.getUserObject(); } return null; }
/** * @return A Spatial if the UserObject of the PhysicsCollisionObject is a Spatial */ public Spatial getNodeA() { if (nodeA.getUserObject() instanceof Spatial) { return (Spatial) nodeA.getUserObject(); } return null; }
/** * @return A Spatial if the UserObject of the PhysicsCollisionObject is a Spatial */ public Spatial getNodeA() { if (nodeA.getUserObject() instanceof Spatial) { return (Spatial) nodeA.getUserObject(); } return null; }
/** * @return A Spatial if the UserObject of the PhysicsCollisionObject is a Spatial */ public Spatial getNodeB() { if (nodeB.getUserObject() instanceof Spatial) { return (Spatial) nodeB.getUserObject(); } return null; }
@Override public void collide(Bone bone, PhysicsCollisionObject pco, PhysicsCollisionEvent pce) { Object userObj = pco.getUserObject(); if ((userObj != null) && (userObj instanceof Geometry)) { Geometry geom = (Geometry) userObj; // Floor name is now being set from config - need to revisit this area // if (PhysicsStuffBuilder.GEOM_FLOOR.equals(geom.getName())) { if (geom.getName().toLowerCase().contains(GoodyPhysicsStuffBuilder.GEOM_FLOOR.toLowerCase())) { return; } theLogger.info("Bone {} collided with userObj-geom named {}, which is not the floor", bone.getName(), geom.getName()); } else { theLogger.info("Bone {} collided with something, userObj is {}", bone.getName(), userObj); } myRagdollKinematicControl.setRagdollMode(); }
if (objA.getUserObject() instanceof PhysicsBoneLink) { PhysicsBoneLink link = (PhysicsBoneLink) objA.getUserObject(); if (link != null) { hit = true; if (objB.getUserObject() instanceof PhysicsBoneLink) { PhysicsBoneLink link = (PhysicsBoneLink) objB.getUserObject(); if (link != null) { hit = true;
if (objA.getUserObject() instanceof PhysicsBoneLink) { PhysicsBoneLink link = (PhysicsBoneLink) objA.getUserObject(); if (link != null) { hit = true; if (objB.getUserObject() instanceof PhysicsBoneLink) { PhysicsBoneLink link = (PhysicsBoneLink) objB.getUserObject(); if (link != null) { hit = true;
if (objA.getUserObject() instanceof PhysicsBoneLink) { PhysicsBoneLink link = (PhysicsBoneLink) objA.getUserObject(); if (link != null) { hit = true; if (objB.getUserObject() instanceof PhysicsBoneLink) { PhysicsBoneLink link = (PhysicsBoneLink) objB.getUserObject(); if (link != null) { hit = true;