View Issue Details

IDProjectCategoryView StatusLast Update
0001586FSSCPscriptingpublic2008-03-24 05:59
ReporterNuke Assigned ToWMCoolmon  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.9 
Summary0001586: vector multiply and devide dont seem to work
Descriptionseems like any time i try to multiply or divide 2 vectors, i get a zeroed result. im using the latest scripting debug build, or the Srs bsnss build.

this doesnt appear to effect vector * number or vector / number. see sample script.
Additional Information#Conditional Hooks
$State: GS_STATE_GAME_PLAY

$On Frame:
[
ship = mn.Ships["Alpha 1"]
    
if ship:isValid() then
local dvec = ship.Physics.RotationalVelocityDesired
local mvec = ship.Physics.RotationalVelocityMax
local avec = dvec / mvec
local bvec = dvec * mvec
gr.drawString(dvec.x.." "..dvec.y.." "..dvec.z,5,50)
gr.drawString(mvec.x.." "..mvec.y.." "..mvec.z)
gr.drawString(avec.x.." "..avec.y.." "..avec.z)
gr.drawString(bvec.x.." "..bvec.y.." "..bvec.z)
end
]
#end
TagsNo tags attached.

Activities

Wanderer

2008-01-25 23:42

developer   ~0008838

Umh.. AFAIK vectors are generally not multiplied with another vector - not directly any way. In general you either use scale-vector multiplication, or dot or cross product of two vectors. Or combination of there-of.

WMCoolmon

2008-03-23 11:06

developer   ~0009016

Right. Vector multiplication and division isn't defined mathematically, at least not AFAIK. What were you trying to accomplish with it?

Nuke

2008-03-24 03:04

reporter   ~0009024

Last edited: 2008-03-24 03:05

it has its uses for dealing with euler angles. mainly i was using it for capturing joystick data from the players ship on a -1 to 1 (as a vector to store roll pitch and yaw) scale and multiplying that by another vector containing values to be scaled. in this case i was essentially trying to do this:

XYZ = ship.Physics.RotationalVelocityDesired / ship.Physics.RotationalVelocityMax

instead of this:

X = ship.Physics.RotationalVelocityDesired.y / ship.Physics.RotationalVelocityMax.y
Y = ship.Physics.RotationalVelocityDesired.x / ship.Physics.RotationalVelocityMax.x
Z = ship.Physics.RotationalVelocityDesired.z / ship.Physics.RotationalVelocityMax.z

really im just being lazy. i could have sworn i saw a vector multiply in the scripting.html at some point (i probably confused it with something out of one of my c++ projects).

WMCoolmon

2008-03-24 05:59

developer   ~0009025

Makes sense. I updated this in my local codebase, it'll be in my next build.

Issue History

Date Modified Username Field Change
2008-01-24 03:38 Nuke New Issue
2008-01-24 03:38 Nuke Status new => assigned
2008-01-24 03:38 Nuke Assigned To => WMCoolmon
2008-01-25 23:42 Wanderer Note Added: 0008838
2008-03-23 11:06 WMCoolmon Note Added: 0009016
2008-03-24 03:04 Nuke Note Added: 0009024
2008-03-24 03:05 Nuke Note Edited: 0009024
2008-03-24 05:59 WMCoolmon Note Added: 0009025
2008-03-24 05:59 WMCoolmon Status assigned => resolved
2008-03-24 05:59 WMCoolmon Resolution open => fixed