Physics Objects & Player Interaction
by Richard Hebblewhite · in Torque 3D Professional · 02/04/2015 (1:21 pm) · 4 replies
I'm currently playing around with different ways of creating a "gravity gun" effect for use with PhysX objects. The old T3D v 1.0.1 had the gravity gun weapon but that made use of a ForceRay if I remember well. Is that method still available within the latest T3D build or was it nerfed a while back ?
My aim is to create Half-Life style object stacking or obstruction based puzzles etc.
Any ideas would be welcome!
My aim is to create Half-Life style object stacking or obstruction based puzzles etc.
Any ideas would be welcome!
About the author
Senior Lecturer at Glyndwr University, Wrexham. Director of RareBit Interactive & Programme Director for Computer Game, Immersive Technology and Creative Computing Programmes.
#2
02/25/2015 (2:41 pm)
I'm pretty sure ForceRay still exists, but I'm not an expert in our physics integrations at the moment so I'm not sure how well it works. We should definitely have some sort of gravity gun to test physics features with.
#3
just thought , maybe youd like this
www.garagegames.com/community/blogs/view/22725
02/25/2015 (7:08 pm)
Mr. Heeblewhite , Hello just thought , maybe youd like this
www.garagegames.com/community/blogs/view/22725
#4
@Henry: Thanks for that, it sounds logical, although I was hoping I wouldn't have to develop something from scratch. Grrrr
@Daniel: I'm pretty sure I was getting a "unknown command" console error when I last tried to use ForceRay (T3D v3.6.2). Although I was messing around with the old script from the v.101 grav gun.
@James: I like Roberts particle beam - it's cool.
03/04/2015 (7:49 am)
Thanks for the replies guys! I haven't had much time to work on this over the last week or two, but I'll be looking at it again over the coming days. @Henry: Thanks for that, it sounds logical, although I was hoping I wouldn't have to develop something from scratch. Grrrr
@Daniel: I'm pretty sure I was getting a "unknown command" console error when I last tried to use ForceRay (T3D v3.6.2). Although I was messing around with the old script from the v.101 grav gun.
@James: I like Roberts particle beam - it's cool.
Torque Owner Henry Todd
Atomic Walrus
If you're holding down the trigger it should raycast a certain distance along the muzzle vector. If it hits a physics object that is not currently "held" then it is "picked up."
When an object is picked up set the "hold distance" to the distance that object currently is from the muzzle point.
"Held" objects will attempt to move to the point defined by muzzlePoint + (muzzleVector * holdDistance). Their rotation is held constant so they don't spin around in the air. I'd do all of this in processTick (try just applying some arbitrary amount of force in the direction of the hold point until you dial it in)
If the player releases the trigger the object is no longer "held" and it just returns to processing physics normally, which means you can "fling" objects by releasing during an arc motion.
What this should do is allow you to point at an item, hold down the mouse button and move it around on a sphere around the player. Then you might want to implement a control for increasing or decreasing the hold distance (radius), maybe the mouse wheel. Rotation control after that if desired.
The HL2 grav gun is a simplification of this concept; The "hold distance" is hard-coded to be very short and rotation is automatic.