Game Development Community

Mounting Problem

by Caleb · in Torque Game Engine · 07/07/2006 (7:37 am) · 4 replies

All I have right now is my Main Character and my AI Enemy. when running the game a sword mounts fine to the AI but not to the Main Guy.

img402.imageshack.us/img402/8725/mountprob0gg.gif
I don't understand why this happens, especially since the to models are exatly the same.
One has blue skin (the AI), and one has red skin (the Main Player).

The only thing I can think of is you have to use different mount code for playable characters.
Whatever the problem, help would be good.

#1
07/08/2006 (8:11 am)
YEA! I fixed the mounting problem!

I got another question, how do I do collision detection on the sword?
I know how to do it on other objects but not on mounted objects. I thought I should do somthing like this:
datablock ShapeBaseImageData(shortsword)
{
   shapeFile = "~/data/shapes/customobj/weapons/shortsword/shortsword.dts";
};

function shortsword::onCollision(%this, %obj, %col)
{
   echo("attacking");
   //other code
}

I know it's most likly somthing simple, but I still need help.
Thanks.
#2
07/08/2006 (8:36 am)
Welcome to my nightmare :)
Collsion detection and mounted objects.

www.garagegames.com/mg/forums/result.thread.php?qt=31697

I've attempted the same thing in the past, left with nothing useful.

Cause you see, only players, vehicles, and a few other objects actually do collision detecting.

So i think the best way to go about it, and this is theory. During the players movement/animation you should find some way for it to include the collision mesh of the mounted object into the calcualations for collision.
How do you do this? Can this really be done? I'm uncertain. :P But that's an approach i'll take again in the future if and when i try this again.


BUT let me tell you this, if you're mounting an IMAGE, then an IMAGE has no collision detection at all.
You'll need to go about a raycasting method instead.
#3
07/09/2006 (8:42 am)
Well I tried making my sword an AI and then mounting it, (I figured this out when I mounted my AI Guy, it look really cool). Anyways it would detect when I ran into it, but not when I would try attacking my AI, hmmm.

P.S. I'll look into ray casting.
#4
07/09/2006 (9:29 am)
Hmmmm! I've got an Idea! Hey could someone tell me how to disable the collision on a mounted object?
My sword keeps getting in the way as an AI.

Thanks.

[Update]
Finally! I can now kill my AI with my sword, it took a long time and I used a method that I do not recomend for any large game. (I'm gona have to figure something else out), but in the meantime for my small demo, it works fine. Now got to be able to block, get my AI Guy's sword working and make my AI able to block. O' yea, I still need to know how to disable collision.

[Update]
Well I made two C++ functions that allow me enable/disable collision by script. However it still lags or jumps when I'm running or if I try to run through my AI Guy. It's like I have to push through them.

If anyone has a solution, please post.