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 / please helm ime haveing problems with bullets! (from the position of a limb)

Author
Message
crazeymark
21
Years of Service
User Offline
Joined: 3rd Nov 2003
Location:
Posted: 3rd Jan 2004 22:42
hi, ime trying to make a bullit system for my game and i ant doin to well at all basicley i have hit a brick wall ime trying to make the bullit cume from a moveing turrit (e.g. a tank turrit) i know i need to dp something with the x/y/x corordenets for the limb (limb 12 from the hi rez tank in the x-mass pressie from the game creators)
but so far i havent had much luck here is my code sorry it isent to neat :S

thanks if you can help this is reley beeping me off cos i wont to get on with the AI whch i cant reley do untill i have the player object sorted out

p.s. can you comment anything you post so i can understand what you have put so i can change the code around for diffrent games and basicley so i dont have to use code i dont understand thanks
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 4th Jan 2004 01:25
r u takking the pise? cos if u arr, yuo hav been rummbld.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
apmoh
21
Years of Service
User Offline
Joined: 23rd Jul 2003
Location:
Posted: 5th Jan 2004 19:52
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 7th Jan 2004 16:39
Well, firstly:

if x#=1 then x = 360
if x#=360 then x = 1
if y#=1 then y = 360
if y#=360 then y = 1
if z#=1 then z = 360
if z#=360 then z = 1

Should really be:

if x#=1 then x# = 360
if x#=360 then x# = 1
if y#=1 then y# = 360
if y#=360 then y# = 1
if z#=1 then z# = 360
if z#=360 then z# = 1

But that's not logical, use wrapvalue instead, like x#=wrapvalue(x#) - it returns an angle from any number, very usefull command indeed.

To use limb angles properly, you really need to break your model up logically. For instance, if I wanted a turret that could rotate left and right, and pitch up and down, I'd have 3 limbs. The first limb would be the turret itself, the second limb would be the barrel of the turret. Now you may not need this, but I like to do it this way:

Add a third limb, just a box, you can hide it if you like - but it has to be positioned at the end of your turret where the bullet exits. This would be linked to the barrel which in turn is linked to the turret base. Now, the limb pivot points are fairly logical, one at the base, one at the turret swivel point, and the third one in the middle of the cube.

Now, once you load this model into DB, you could rotate the turret left and right using limb 1, then pitch it up and down using limb 2. When firing you can position the bullet object at limb position 2 and point it at limb position 3, then simply moving the object is enough to fire it out in the direction of the turret. You can use trig to calculate angles, like for AI, you'd calculate the angles in 2D to get the Y angle, then do the same for the pitch.

I tend to rely on limb positions more than limb angles and directions, you know where you stand with your own 3D maths, less chance of the model messing with your results.


Van-B


Next time he runs past, GRAB HIM!

Login to post a reply

Server time is: 2025-05-22 06:31:25
Your offset time is: 2025-05-22 06:31:25