Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Help with adding Limbs in exactly the right spot to objects

Author
Message
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 8th Aug 2007 07:26
Hi again, I'm at a loss to know how to do the following, and in fact even if the following is the best approach. I'm writing a 3D space shooter (but effectively the game takes place in a 2D plain (the Z axis is always zero)). I have a number of 3D ship models and have come to the stage where I need to include exhaust and thruster emissions. Currently I have positioned a ghosted plain behind each spaceship to which I texture each thruster image to create the emission effect. It works well. however, I need to position 3 more plains (left, right and reverse thrust) to the sides and front of the craft to create strafing and reverese thrust effects. The quesitons I have are these.

1) Rather than continually reposition 4 Plains to be alongside or behind each ship in question, wouldnt adding these plains as limbs to the ship be a) easier to code (i.e. only have to update the ship position each loop and not ship + 4 plains) and b) make it all work faster (better FPS)?

2) If the answer to 1) is yes then how exactly do you tell DB to "glue" the limb in exactly the right spot of the object at the right angle etc so that it works correctly. I've read a few posts on this regarding meshes and although I understand objects have mesh points I dont how to find out what they are or how they relate exactly to the limb. I think we need to go back to a couple of steps (baby school for me) as I just dont get it. For example a typical spaceship model I have created might have 600 polygons which probably relates to say 2000+ mesh points(?). Do I just need to keep tryalling and erroring to find the right one and even if I find it, how do I get the plain to angle itself correctly. Also in case anyone is worried that this would create collision detection problems then dont because I use my own collision system rather than DBs object collision command.

Thanks in advance for your help with this.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 8th Aug 2007 12:34
I don't think using limbs is a good idea, if you have reposition the plains in sequence the trail will strafe naturally

Your signature has been erased by a mod because it was rubbish.
Comrade Robski
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location:
Posted: 8th Aug 2007 14:09 Edited at: 8th Aug 2007 14:16
Hi, Hangar18

I don't have DBC in front of me, so I may make mistakes with the command names - check the help file.

Limbs are constructed from meshes, which can either be loaded using LOAD MESH or made from an existing object, using MAKE MESH FROM OBJECT. If you are using simple planes, I would do the following:



When you ADD LIMB to an object, you specify the parent object (in this case your spaceship) and the mesh number you want to make the limb from.

Once added, the limb can be positioned using OFFSET LIMB, and specifying positive or negative X Y Z values. These values are relative to the parent object position in the orientation it is in when you add the limb. The limb can be rotated relative to the parent object using ROTATE LIMB. Naturally the limbs of an object move and rotate with the parent object. The position and angle of the limb is not related to any mesh point or vertex of the parent object (I think this may have been the source of confusion).

A problem arises because in DBC, as far as I know, there is no GHOST LIMB ON command - all the limbs of a specific object share the ghost status of the parent object. This has proved quite annoying to me. One workaround is to have a dummy parent object which is ghosted and placed inside your spaceship object, and moved with it. However, this means you're back to moving around two objects.

There is a SET LIMB command, so you can set a limb to transparent, but this may not have the desired effect (I doubt it would for a thruster plume for example). Limbs can also be hidden and shown separately from the parent.

So in summary, limbs are a good way to go to achieve what you want to do, and will simplify your code even if it doesn't increse the FPS. The only drawback I can see is the ghosting issue.

Hope this helps - sorry if I've mis-remembered any of the commands, look them up before you try them!
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 8th Aug 2007 16:46
@CR
sorry to crap all over your detailed explanation, I just think it's a lot easier to have a number of plains and position them slightly behind the spaceship in sequence so there is a delay between each plain being repositioned. This way they will all hover around the spaceship until it moves, then there will be a natural stream.
use sine and cosine if you want a more random feel to the stream


Your signature has been erased by a mod because it was rubbish.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 8th Aug 2007 18:59
@Hangar

If you use glue object to limb and glue 3 objects to your main space ship (limb 0) you can avoid creating individual limbs and maintain full control of the object options - you can also avoid repositioning the objects if you are trying to reduce computation overhead.

When a object is glued, it will behave much in the manner Comrade Robski describes in regards to it's relative position. But instead of using offset limb, you position the objects as if their origin is 0,0,0. This will automatically offset them in relation to whatever limb they are glued to.

Ex: The sphere is the main ship, and the 3 cubes would be the thrust objects. Use the arrow keys to move around.



Enjoy your day.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 8th Aug 2007 19:34 Edited at: 8th Aug 2007 19:39
Here's an edited version of Latch's example. I've replaced the cubes with a trail of cubes.
You can see the problem with this method is that the trail doesn't strafe like a real flame would.
I'm sure Latch will pull something out that proves me wrong


[EDIT]
Ohhh, I can't work out how to do it my way

Your signature has been erased by a mod because it was rubbish.
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 9th Aug 2007 02:18 Edited at: 9th Aug 2007 02:19
@Obese87 thanks, you have given me a great idea for the main thruster! - however the side and front thrusters i think i want fixed for simplicity and the fact they are small in comparison.

@ComradeRobski: Thank you! What you said makes perfect sense and I will try it out when I get home tonight. And great idea re: the ghost plain (limbs) workaround, although as you say it means working with 2 objects.

@Latch: Thanks, like the idea! I get what you mean although I'm surprised the "glueing" happens before the positioning of the cubes (but having never tried it how would i know ). I would have thought you need to position the cubes first, then glue them to the sphere but I will experiment with it tonight.

Thanks guys for your help - without the help of yourselves and others on this forum, I would have probably given up long ago.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 9th Aug 2007 19:06 Edited at: 9th Aug 2007 19:08
Quote: "I get what you mean although I'm surprised the "glueing" happens before the positioning of the cubes (but having never tried it how would i know ). I would have thought you need to position the cubes first, then glue them to the sphere but I will experiment with it tonight."

When you glue an object to another, it positions the glued object in the centre of the host object. So positioning the object first would only be wasting a command
I think this is a stupid way of doing it though and your assumption would work better

You could also try using a cone and rescaling it or changing it's color depending on how the spaceship moves.

Your signature has been erased by a mod because it was rubbish.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 9th Aug 2007 19:39
@Hangar

Quote: "... I'm surprised the "glueing" happens before the positioning of the cubes (but having never tried it how would i know ). I would have thought you need to position the cubes first, then glue them to the sphere"


Once you glue an object to a limb, it's position becomes that of the limb, therefore you position the object after the gluing so it will be relative to the limb. Depending on how fancy you want to get, you could have animated figures as objects. Once you glue these objects to a limb, their animations can remain independant of the main object to which they are glued. A few good features of this method is that you can use any object manipulation functions that are available, and you never have to recalculate or position the glued objects once they have been initially positioned (unless you want to) - and I already mentioned that each glued object can have it's own animation and of course, it's own set of limbs.

You could even use this for, say, a wing. If the wing get's hit by gunfire, you could simply unglue it and send it spiraling off into oblivion.

Enjoy your day.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 9th Aug 2007 21:29 Edited at: 9th Aug 2007 21:30
Quote: "You could even use this for, say, a wing. If the wing get's hit by gunfire, you could simply unglue it and send it spiraling off into oblivion."

cool idea

or you could chop people's limbs off

Your signature has been erased by a mod because it was rubbish.
Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 9th Aug 2007 22:21
That does sound cool... Hey! You've just inadvertedly solved my texture problem!

(N-1)/n*100<n2/n-n/2+n/4*2+100

Login to post a reply

Server time is: 2025-05-30 13:24:27
Your offset time is: 2025-05-30 13:24:27