Game Development Community

OnThrow items

by SpaceMonkey · in Torque Game Engine · 11/22/2006 (8:09 am) · 1 replies

Hi,
I'm trying to figure out how to use the onThrow method such that when an Item is thrown, it is dropped closer to the player. As of now, it is getting throw away from the player. I believe it has something to do with the velocity (I might be wrong). Anyone know which part of the code I should look at?

Thanks!

#1
11/24/2006 (1:29 am)
Look for this in inventory.cs (server/scripts):

function ShapeBase::throwObject(%this,%obj)

You'll see this just below it:

%throwForce = %this.throwForce;
if (!%throwForce)
%throwForce = 20;

Since it's unlikely that your player has throwForce defined in its DataBlock (I think this throw code is a little outdated, pretty much Tribes 2 stuff), it's probably just using a force of 20. Basically, change the value of %throwForce in this function to something that works for the mass of your items. Just try a few values and see what creates the desired effect.