| Blockland Forums > Modification Help |
| initContainerBoxSearch units |
| << < (4/5) > >> |
| Destiny/Zack0Wack0:
3 2 0.6 |
| Demian:
--- Quote from: Port on January 06, 2012, 01:11:53 AM ---What exact value should I use for a 6x1x4 brick? --- End quote --- --- Quote from: Destiny/Zack0Wack0 on January 06, 2012, 01:38:34 AM ---3 2 0.6 --- End quote --- Correct me if I'm wrong but I'm pretty sure that 6x1x4 brick is 3 0.5 2.4 in Torque units. |
| Destiny/Zack0Wack0:
woops, read it as 6x4x1 |
| Port:
That is rather odd. I tried using 3 0.5 2.4, but players that are even approximately 6 studs away are killed too from this code: --- Code: ---datablock fxDTSBrickData( brickSawBladeShapeData : brick1x6x5Data ) { category = "Wario Ware"; subCategory = "Micro-Games"; uiName = "Sawblade"; brickSizeX = 1; brickSizeY = 6; brickSizeZ = 4; brickFile = "./1x6x4.blb"; }; function brickSawBladeShapeData::onPlant( %this, %obj ) { %obj.sawBlade = new staticShape() { position = %obj.position; rotation = rotateVector( %obj.rotation, 3 ); datablock = sawBladeShapeData; }; missionCleanup.add( %obj.sawBlade ); %obj.setRendering( false ); %obj.setColliding( false ); %obj.setRayCasting( false ); } function brickSawBladeShapeData::onRemove( %this, %obj ) { if ( isObject( %saw = %obj.sawBlade ) ) { %saw.delete(); } } datablock staticShapeData( sawBladeShapeData ) { shapeFile = "Add-Ons/System_WarioWare/shapes/sawblade.dts"; doColorShift = true; colorShiftColor = "0.4 0.4 0.4 1"; }; function sawBladeShapeData::onAdd( %this, %obj ) { %start = getWords( %obj.getTransform(), 0, 2 ); %rotation = vectorNormalize( axisToEuler( getWords( %obj.getTransform(), 3, 6 ) ) ); %interval = 25; %speed = 0.075; %maxDistance = 8; %rota = getWord( %rotation, 0 ); %rotb = getWord( %rotation, 1 ); if ( mAbs( %rota ) > mAbs( %rotb ) ) { if ( %roab > 0 ) { %rotation = 3; } else { %rotation = 1; } } else { if ( %rotb > 0 ) { %rotation = 2; } else { %rotation = 0; } } switch ( %rotation ) { case 0: %offset = vectorScale( "1 0 0", %speed ); case 1: %offset = vectorScale( "0 1 0", %speed ); case 2: %offset = vectorScale( "-1 0 0", %speed ); case 3: %offset = vectorScale( "0 -1 0", %speed ); } %this.sawMove( %obj, %start, %offset, 0, %maxDistance, 1, %interval ); } function sawBladeShapeData::onCollision( %this, %obj, %col ) { if ( %col.getClassName() $= "player" ) { %col.setVelocity( vectorScale( vectorSub( %col.getPosition(), %obj.getPosition() ), 6 ) ); %col.hideNode( "headSkin" ); %col.kill(); } } function sawBladeShapeData::sawMove( %this, %obj, %start, %offset, %index, %limit, %direction, %interval ) { cancel( %obj.sawMove ); // echo( "sawBladeShapeData::sawMove - " @ %index SPC %direction SPC %offset SPC vectorAdd( %start, vectorScale( %offset, %index ) ) ); if ( !isObject( %obj ) ) { return; } if ( vectorDist( %start, %obj.getPosition() ) >= %limit && %direction == 1 ) { %direction = -1; } if ( %index <= 0 && %direction == -1 ) { %direction = 1; } %obj.setTransform( vectorAdd( %start, vectorScale( %offset, %index ) ) ); initContainerBoxSearch( %obj.getPosition(), "3 0.5 2.4", $TypeMasks::PlayerObjectType ); while ( isObject( %col = containerSearchNext() ) ) { %this.onCollision( %obj, %col ); } %obj.sawMove = %this.schedule( %interval, sawMove, %obj, %start, %offset, %index + %direction, %limit, %direction, %interval ); } --- End code --- |
| Destiny/Zack0Wack0:
You need to make sure the 3 and 0.5 are around the right way based on it's rotation. |
| Navigation |
| Message Index |
| Next page |
| Previous page |