Package net.physx4java.dynamics.collision

Source Code of net.physx4java.dynamics.collision.CollisionHandling

package net.physx4java.dynamics.collision;
import javax.vecmath.Vector3f;
import net.physx4java.WorldPhysX;
import net.physx4java.dynamics.actors.Actor;

public class CollisionHandling {
  public static void onContactNotify(int actorid1, int actorid2, int flags, float sumFrictionForce_x, float sumFrictionForce_y, float sumFrictionForce_z, float sumNormalForce_x, float sumNormalForce_y, float sumNormalForce_z) {
    // first create and fill contactpair
    ContactPair contactPair = new ContactPair();
    Actor actor1 = WorldPhysX.getActorById(actorid1);
    Actor actor2 = WorldPhysX.getActorById(actorid2);
    contactPair.setActor1(actor1);
    contactPair.setActor2(actor2);
    // get world
    WorldPhysX world = actor1.getWorld();
    // System.out.println(actor1+" "+actor2+" "+world);
    // if(2+2==4) return;
    contactPair.setSumFrictionForce(new Vector3f(sumFrictionForce_x, sumFrictionForce_y, sumFrictionForce_z));
    contactPair.setSumNormalforce(new Vector3f(sumNormalForce_x, sumNormalForce_y, sumNormalForce_z));
    contactPair.setFlags(flags);
    // call listeners
    CollisionListener listener = world.getListener();
    listener.onContactNotify(contactPair);
  }
}
TOP

Related Classes of net.physx4java.dynamics.collision.CollisionHandling

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.