relative rotation

This commit is contained in:
ericrius1 2015-12-18 15:38:01 -08:00
parent 514cb7a329
commit fffe6dbb9b
2 changed files with 7 additions and 10 deletions

View file

@ -35,22 +35,17 @@ ArcBall = function(spawnPosition) {
z: 0
}),
dimensions: {
x: .2,
y: .2,
z: .5
x: .1,
y: .1,
z: .2
},
color: {
red: 15,
green: 10,
blue: 150
},
mass: 10,
damping: 0.8,
collisionsWillMove: true,
// gravity: {
// x: 0,
// y: -0.5,
// z: 0
// },
userData: JSON.stringify({
grabbableKey: {
invertSolidWhileHeld: true

View file

@ -34,8 +34,10 @@
createBeam: function(startPosition, endPosition) {
print("CREATE BEAM")
// Creates particle arc from start position to end position
var rotation = Entities.getEntityProperties(this.entityID, "rotation").rotation;
var sourceToTargetVec = Vec3.subtract(endPosition, startPosition);
var emitOrientation = Quat.rotationBetween(Vec3.UNIT_Z, sourceToTargetVec);
emitOrientation = Quat.multiply(Quat.inverse(rotation), emitOrientation);
testBox = Entities.addEntity({
type: "Box",
@ -65,7 +67,7 @@
},
colorFinish: color,
maxParticles: 100000,
lifespan: 2,
lifespan: 6,
emitRate: 1000,
emitOrientation: emitOrientation,
emitSpeed: .4,