Game Development Community

Notes, input and more.

by Lars Nilsson · in Torque 3D Beginner · 03/11/2014 (6:40 am) · 11 replies

Hello!

First off, I am sorry. My TorqueScript skills are very limited and just got into it a bit.

I am trying to do some cool experiments in T3D. I have a rigidshape that I want either to be pushed by collision of the player, or better yet, being dragged or moved with the mouse. That would be awesome! But I cannot really find too much information about it.

Another thing I want to do is the ability to find notes. This is, maybe a note-model on a table. If you click it, you will read it (here the GUI would show up). What would have been better here would be if you could save these notes or fragments of them to a GUI list or something. So you can reread them if there is some important information you need.

How hard would this be? Where should I start? If I do this, I can basically start the hard but fun work.

Thanks,

#1
03/11/2014 (6:47 am)
Neither of these is "simple." You should start with the documentation, following Mr. Perry's advice from this thread (esp. posts #6 and #7). Once you are more comfortable with Torquescript in general you should then move on to the RTS Prototype (in the documentation under Scripting/Advanced) - but keep in mind that the RTS Prototype is for versions of T3D 3.0 and earlier; there are changes in the scripts that break some functionality, but for your click-to-select stuff you should be able to get what you need from it.

The learning curve is steep. Climb that hill and win the day, or sit down and accept defeat: The choice is yours.
#2
03/11/2014 (6:48 am)
Look at the test boulder in art/shapes/rocks. Load it via the editor as a script object (not the meshes). RigidShape must have convex collision meshes exported with the model - you can't just set it afterwards --- unless maybe you do it via the shapeEditor.
#3
03/11/2014 (7:02 am)
@Steve Oh, and is it "Pushable"? Maybe I can replace the mesh with the one I want to move?
#4
03/11/2014 (7:15 am)
Quote:following Mr. Perry's advice
GAH! Mich...just Mich or Michael. No Mr. Perry. >_<

@Lars - Follow both Richard and Steve's advice. You'll need to know TorqueScript better to get all the collision and reaction working properly. As a starter asset to work with, use the test boulder. Additionally, there is a "marble demo" Dave Wyand wrote for the Leap Motion. That might be very useful to you. Just search his blogs.
#5
03/11/2014 (8:18 am)
The test boulder is a rigid physics object. It will react to physics forces. It is "pushable" if you handle adding impulses correctly in the onCollision() callbacks of the player and the rigid shape in question ... which is why you have to learn Torquescript.

Mr. Perry ... <snicker>
#6
03/13/2014 (5:29 am)
Got some code working now. Trying out the Bouncing Ball as RigidShape object at the moment. It looks slightly like he "kicks" the ball, then sometimes it randomly drops through the floor.

Here is my code:
pastebin.com/C7axWpfd

I am thinking of maybe using a table or similar to block a door. So you will have to push it aside. Then it would not make sense if the character "kicks" the table and it falls through the floor.

Thanks again,
#7
03/13/2014 (6:25 am)
You will have to fiddle with the RigidShape datablock, specifically the physics properties -
// Rigid Body
   mass = 50;
   massCenter = "0 0 0";    // Center of mass for rigid body
   massBox = "0 0 0";         // Size of box used for moment of inertia,
                              // if zero it defaults to object bounding box
   drag = 0.2;                // Drag coefficient
   density = "4";
   bodyFriction = 0.2;
   bodyRestitution = 0.25;
   minImpactSpeed = 5;        // Impacts over this invoke the script callback
   softImpactSpeed = 5;       // Play SoftImpact Sound
   hardImpactSpeed = 15;      // Play HardImpact Sound
   integration = 4;           // Physics integration: TickSec/integration
   collisionTol = 0.25;        // Collision distance tolerance
   contactTol = 0.3;          // Contact velocity tolerance
Try these values for a start - the object should drop through the terrain much less often. Fiddle with the mass, tolerances, and impact speeds to tune it.
#8
03/13/2014 (6:47 am)
Tried it now, and either I cannot move the boulder or it is flying to space and drops through floor when it hits the ground. Will tweak the values, also trying other mesh.

Might add that if the RigidShape collides with another mesh, like a wall or something, it starts lagging like crazy.

Update: Got a mesh loading, appliad a box collision to surround the mesh, it acts very strange. Still lagging if colliding with other meshes. Flies all over the place upon collision and drops randomly through floor.
#9
03/14/2014 (6:44 am)
The values above are what I use for my "push the ball" project, though admittedly you don't walk into it to push it - you shoot it with a rocket. Feel free to pull it down and have a look; it's T3D 1.1 though....
#10
03/14/2014 (7:56 pm)
Drops randomly through the floor:

That is most likely because of the lack of Continuous collision detection that the RigidShape has. Try increasing its integration property on the datablock, the more substeps the less chance of it tunneling through.
#11
03/15/2014 (6:54 am)
Will try that. Not home at the moment to try it. I remember setting the integration to something rediculous, like 100 though.