History

change variable names that use Quat.getForward

Triplelexx committed 9 years ago

Commit 2d1ca991 parent 25155637 files · +25 −26Browse files

Showing the changes to scripts/tutorials/entity_scripts (1 of 7 files). Show all

Unified · Split

scripts/tutorials/entity_scripts/pingPongGun.js+7−7
@@ -94,9 +94,9 @@ · 93 unmodified lines
9494 },
9595
9696 shootBall: function(gunProperties) {
97− var forwardVec = Quat.getForward(Quat.multiply(gunProperties.rotation, Quat.fromPitchYawRollDegrees(0, 180, 0)));
98− forwardVec = Vec3.normalize(forwardVec);
99− forwardVec = Vec3.multiply(forwardVec, GUN_FORCE);
97+ var forwardVector = Quat.getForward(Quat.multiply(gunProperties.rotation, Quat.fromPitchYawRollDegrees(0, 180, 0)));
98+ forwardVector = Vec3.normalize(forwardVector);
99+ forwardVector = Vec3.multiply(forwardVector, GUN_FORCE);
100100
101101 var properties = {
102102 name: 'Tutorial Ping Pong Ball',
@@ -111,7 +111,7 @@ · 8 unmodified lines
111111 rotation: gunProperties.rotation,
112112 position: this.getGunTipPosition(gunProperties),
113113 gravity: PING_PONG_GUN_GRAVITY,
114− velocity: forwardVec,
114+ velocity: forwardVector,
115115 lifetime: 10
116116 };
117117
@@ -131,12 +131,12 @@ · 13 unmodified lines
131131
132132 getGunTipPosition: function(properties) {
133133 //the tip of the gun is going to be in a different place than the center, so we move in space relative to the model to find that position
134− var frontVector = Quat.getForward(properties.rotation);
135− var frontOffset = Vec3.multiply(frontVector, GUN_TIP_FWD_OFFSET);
134+ var forwardVector = Quat.getForward(properties.rotation);
135+ var forwardOffset = Vec3.multiply(forwardVector, GUN_TIP_FWD_OFFSET);
136136 var upVector = Quat.getUp(properties.rotation);
137137 var upOffset = Vec3.multiply(upVector, GUN_TIP_UP_OFFSET);
138138
139− var gunTipPosition = Vec3.sum(properties.position, frontOffset);
139+ var gunTipPosition = Vec3.sum(properties.position, forwardOffset);
140140 gunTipPosition = Vec3.sum(gunTipPosition, upOffset);
141141
142142 return gunTipPosition;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t