Question regarding custom terrain object placement
by Nic Biondi · in General Discussion · 01/28/2004 (3:13 pm) · 2 replies
I need to be able to place objects on the terrain in a specific manner. Instead of being able to place an object anywhere you like, I want to divide the placement erea into blocks. So that objects need to be placed in a grid.
What I have done:
I already have the object creation and raycasing done so that I can place my objects. Now i need to find a way to make those objects "snap to grid".
this function :
Is there an easy way to do this? I am thinking somewhere along the lines of an equation. I just need something to get me on the right track
What I have done:
I already have the object creation and raycasing done so that I can place my objects. Now i need to find a way to make those objects "snap to grid".
this function :
%item.setTransform(%x SPC %y SPC %z);is what I am using, populating the x,y, and z values using:
%object = ContainerRayCast(%startPoint,%endPoint,%searchMasks, %player);
Is there an easy way to do this? I am thinking somewhere along the lines of an equation. I just need something to get me on the right track
#2
04/06/2004 (2:56 pm)
Why not just use [url="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_ceil.asp"]ceil,ceilf[/url] or [url="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_floor.asp"]floor,floorf[/url]?
Torque Owner Nic Biondi
Default Studio Name
For instance, using just the x-val as an illustration:
if I have a block that is x=555, I need to round it down to x=550.
if I have a block that is x=520, I need to round it down to x=500.
This can be accomplished by nested if's, for example:
(meta-code)
if x<25 -round to 0 if x<50 -round to 25 if x<75 -round to 50 if x<100 -round to 75I still have one problem though. I can isolate the last two didgets of my possition number by multiplying the number by .01.
but how can I extract just the decimal?