Interesting sword clipping problem...

Hey all.
I’ve recently been fiddling around with Social’s excellent FPS template
(http://blenderartists.org/forum/showthread.php?t=85219&highlight=FPS+Template)
and I modded his mouse-aim rifle script to make a 3d sword that you can move with the mouse :D. Problem is, though, it’s got some major clipping problems. the boxes that are set up go through the floor when you bash them with the handle :eek:, fly around when you hit them, and clip through the wall something awful. Oh, and randomly the sword hits yourself and you go through the wall too :rolleyes:. The second problem I could probably just move the empty that the sword tracks to a bit farther out to keep it from turning the wrong way… but I’m not sure how to stop the clipping boxes. Maybe if I had a python script that applied torque over time to track to the empty instead of the normal way (where the movement can’t be deflected and the boxes haven’t got a chance)?
Here’s the .blend file - sorry I’m using rapidshare.
http://rapidshare.com/files/61124846/Sword.blend
Thanks!
Jauffre

Interesting concept. But I think that you should first resolve the control problem, first. It’s very hard to handle the sword.

one of the ideas would be to copy the sword to an over-lay scene

I see… so that the sword won’t react with anything but it’ll remain visible on the screen… only problem with that, though, is making physical objects react to it. Twould clear up the clipping problem, but it’s so satisfying to see your sword hit something and glance off. Instead, maybe I could just make the sword ghost in the GE and make objects react to it with a collision sensor and a force actuator?

And yah, I realize the controls are kind of screwy at the moment… fixing it as best I can.

just try to make a …
ok
here goes (( blend)) (i have made an instance of it but without the level and it is overlay and interactive at the same time )

the idea is to clone the sword and make it cover the interactive one with keeping it’s interactivity …
:slight_smile:
try the blend (above) and walk to a wall and it will not intersect (vissualy) and the sword will be interactive as you have requested (it will bounce the boxes)
sorry if i didn’t help :frowning: , … that all i know

I was thinking about something slightly more different…
http://rapidshare.com/files/61173255/Sword.blend
look at this and run the sword through the second wooden block from the bottom (the one selected originally). Notice how the sword is ghosted, and the box has a collision sensor with a dloc movement actuator? That’s pretty much what i need. Only problem is, how do I make a python script so that the force applied to the box matches/comes from the location of the sword, so that the box moves in the correct direction when hit? even a slight approximation would be awesome (e.g. from the center of the sword). Maybe a way to detect which face it’s colliding with and apply the force based on the face side?

Eurika!
blend

All it took was the subtraction of the two objects’ positions! Now my ghosted sword can ‘collide’ with objects without having them zoom away at unreasonable speeds or fall through the floor.
This script would aso be useful for always making an object rebound at a constant velocity…
Guess I should somehow start work on the AI, but for now, problem solved. Thanks for all the support!
Jauff