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.

Newcomers DBPro Corner / Firing a photon torpedo from a space ship

Author
Message
3D Coding
17
Years of Service
User Offline
Joined: 15th Jan 2007
Location: My 3D Spaceship
Posted: 19th Jan 2007 15:48
Using the bullet code from the tutoral works, but that scenario fires directly from the camera position (its made for first person shooter) which fires shot from behind my ship and at a downward trajectory.

What I'm trying to do is to hide the 'bullet' inside my 3D ship which is floating in front of me, and have it fired in a straight line (depending on angle of ship) right out of its nose. Does anybody have any tips on that?

I just got the online version of DBPro (with package deal) yesterday. It runs great on my Gateway laptop! (Radeon 200M)
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 19th Jan 2007 17:01
Well I would assume then that in the tutorial it positions the bullet at camera position x(),camera position y(),camera position z(). All you need to do is change those to object position rather than camera position.

Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 19th Jan 2007 18:48
And set it to the orientation of the ship object, with
Quote: "Set Object to Object Orientation obj1, obj2"



Come see the WIP!
3D Coding
17
Years of Service
User Offline
Joined: 15th Jan 2007
Location: My 3D Spaceship
Posted: 20th Jan 2007 14:59
Thanks! I'll go give that a try!
3D Coding
17
Years of Service
User Offline
Joined: 15th Jan 2007
Location: My 3D Spaceship
Posted: 20th Jan 2007 17:24
This is kind of funny so I thought I would post my 'progress' so far. The coding suggested above works, but naturally solving one problem only leads to another. Heh.

So I set the position of the torpedo in the _firing torpedo routine to match the position of the ship. And also the object orientation. So I try firing the torpedo and now I can't see the torpedo at all. Its gone?

So I set the camera position on the torpedo itself, so I can see where it is. Its obvious that the torpedo is trapped inside the ship, but the camera is located just above and behind the ship. Firing the torpedo it bounces forward as if to chase the torp, and the falls right back. So it looks like the torpedo can't get out because of the object collision with its own ship, I think.

I'm not sure about that. So I set the camera to be right on top of the torpedo by setting parameters to all zeros. Now the camera is right inside the ship. Well, its DARK IN THERE. Heh! So I can't see anything.

So just now I am trying set up a light inside the ship.....

Wish me luck. LOL!
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 20th Jan 2007 17:34
You don't actually have to start the torpedo inside the ship. You can move it to just beyond the ship, then fire it.

Of course, without code, it is hard to say much else.


Come see the WIP!
3D Coding
17
Years of Service
User Offline
Joined: 15th Jan 2007
Location: My 3D Spaceship
Posted: 20th Jan 2007 20:02
I have the torpedo firing now and have collision working with a shuttle craft fying around for target practice. So things are looking better.

A few problems remain.. when the torpedo is restarted, the camera jolts backward for some reason. (I started over again and this time I left camera alone, so I don't understand this.)

Also, when ship is in motion, the torpedo just sort of falls out and sits there instead of shooting forward.

I'm attaching the code so far. Would appreciate any tips on making it work.
Don Malone
21
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 21st Jan 2007 06:48
I think general rule of thumb is that you hide the projectile off screen until it is fired. Then you place it in front of the ship and start it in motion.

If you did place the projectile into the ship. It would have to move every time the ship moves. That code would take frames per second away from a finished application. especially when it has to be done for more than on object in a loop.

Making nothing for the third straight year.

3D Coding
17
Years of Service
User Offline
Joined: 15th Jan 2007
Location: My 3D Spaceship
Posted: 21st Jan 2007 07:35
Dboy780:
Sounds like the ticket. I'll recode that, and thanks for the advice.
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 22nd Jan 2007 01:20
Quote: "Autocam Off"



Come see the WIP!

Login to post a reply

Server time is: 2024-11-26 23:23:18
Your offset time is: 2024-11-26 23:23:18