Morelli Posted March 3, 2008 Share Posted March 3, 2008 When using getElementsWithinColShape to return objects within a collision shape, nothing occurs. Here's a quick test code, for you to try yourself. function Create() -- Just use this to spawn a few objects around the 0,0,0 origin createObject ( 659, 0, 0, 5, 0, 0, 0 ) createObject ( 982, 0, 3, 5, 0, 0, 0 ) createObject ( 765, 3, 0, 5, 0, 0, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Create) function Join( ) spawnPlayer ( source, 0.0, 0.0, 5.0, 90.0, 0, 0, 0, 0 ) fadeCamera( source, true ) end addEventHandler ( "onPlayerJoin", getRootElement(), Join) function Objects( sourcePlayer, command ) local X, Y, Z = getElementPosition( sourcePlayer ) local tempcol = createColSphere( X, Y, Z, 25.0 ) local allObjectsinCol = getElementsWithinColShape ( tempcol, "object" ) for keyObjects,object in pairs(allObjectsinCol) do local x4,y4,z4 = getElementPosition ( object ) local x1,y1,z1 = getObjectRotation ( object ) local model = getObjectModel( object ) outputDebugString("POS ---- x4: " ..x4.. " y4:" ..y4.. " z4:" ..z4 ) outputDebugString("ROT ---- x1: " ..x1.. " y1:" ..y1.. " z1:" ..z1 ) outputDebugString("MODEL ---- model: " ..model ) outputDebugString("--------------------------------------------------------------" ) end end addCommandHandler("object", Objects) I've only tested this on objects which are spawned via the createObject function. Link to comment
Ransom Posted March 10, 2008 Share Posted March 10, 2008 It appears you are right, I'll raise the issue. Thanks. Link to comment
Recommended Posts