Game Development Community

Item help..

by Temasek Polytechnic · in Technical Issues · 05/08/2006 (9:53 pm) · 3 replies

Ok.
I created and item like this:

datablock ItemData(Fence)
{
shapeFile = "~/data/shapes/test4/test4.dts";
category = "Fence";
mass = "100";
};

function ItemData::create(%this,%point)
{
%obj = new Item()
{
datablock = %this;
rotate = false;
static = true;
};
%obj.setScale("20 20 20");
MissionCleanup.add(%obj);
%obj.setTransform(%point);
echo("Fence: " @ %obj);
return %obj;
}


When the user clicks the add button, the item will appear on the screen.
However, the user can run through it like a ghost!!!
How do i stop the player from going through this?

#1
05/08/2006 (10:40 pm)
The Item class doesn't have collision. Try usting StaticShapeData instead of ItemData.
#2
05/08/2006 (11:58 pm)
Thanx Paul, but it still doesn't work...The player can still walk through the fence.

I'm not sure what code needs to be placed in the onCollision method to prevent the player from walking through the fence.