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 Professional Discussion / Draw a plane from a point to other point?

Author
Message
Xystus
22
Years of Service
User Offline
Joined: 2nd Sep 2003
Location:
Posted: 17th Jun 2012 14:29 Edited at: 17th Jun 2012 14:31
I need to draw a plain that starts in point X1,Y1,Z1 and ends in point X2,Y2,Z2 to draw trails of bullets. Any suggestions?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Jun 2012 15:24 Edited at: 17th Jun 2012 15:45
Is the game 2D or fully 3D rotational?

Xystus
22
Years of Service
User Offline
Joined: 2nd Sep 2003
Location:
Posted: 17th Jun 2012 20:11
It´s 3d
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Jun 2012 20:18 Edited at: 17th Jun 2012 20:19
You just need the distance from the gun to the bullet. I would be tempted to use a cylinder with a texture on it, because then you get a more realistic perspective.

Xystus
22
Years of Service
User Offline
Joined: 2nd Sep 2003
Location:
Posted: 17th Jun 2012 20:37
I have the distance between the 2 point with:



But how to place a cylinder that start in:



and ends in:



This is my dilemma
Xystus
22
Years of Service
User Offline
Joined: 2nd Sep 2003
Location:
Posted: 17th Jun 2012 21:26 Edited at: 17th Jun 2012 21:32
Well i have been studying trigonometry for hours and i have my particular solucion, this is for x and z coordinates and for my game scale but this is what i need...

Given two points X1, Z1 and X2, Z2



Sorry for my bad english
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Jun 2012 23:15 Edited at: 17th Jun 2012 23:17
If you make a tube in a modelling package, you can position it to line up with your bullet rear. Then point the tube at the bullet, and it will face the same way in the game. It's position should match the bullet position, because in the modelling package you have set up the cylinder origin to be behind the bullet. I have had an idea that would look really good like the Matrix. You make a special cylinder made from many rings in a line. Like threaded coins. Space them apart a bit, and shade them with alpha blue smoke rings. This would look amazing!

mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 18th Jun 2012 00:53
Hi Xystus!

I have a code snippet that defintely will be useful for you:

This code was made for this thread: http://forum.thegamecreators.com/?m=forum_view&t=196176&b=1&p=0

I think you will get the idea how to use it with your trails.

«It's the Pony, pony me this, pony me that» — Bronies
«I sell apples and apple accessories» — Applejack
Derpy delivers: watch?v=g4Kgz4Us_RI
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 18th Jun 2012 07:29
Quote: "Well i have been studying trigonometry for hours and i have my particular solucion, this is for x and z coordinates and for my game scale but this is what i need...

Given two points X1, Z1 and X2, Z2"


If your two objects are at different y heights this will not work! A better solution would be:



Sometimes the simplest solution is the best one

(Because of the issues with 3D math, you'd need to use matrices to solve this problem otherwise!)

Inflictive
17
Years of Service
User Offline
Joined: 16th Jun 2009
Location: Altis
Posted: 18th Jun 2012 08:41
try this:

make object box #,0.1,0.1,distance(object1,object2)
position object #,(object1position+object2position)/2
point object #,object2position

that should be considered pseudocode btw. I used a box for more realism and easier math like Pincho said, but less polygons

"This plan is so perfect... it's retarded."
Xystus
22
Years of Service
User Offline
Joined: 2nd Sep 2003
Location:
Posted: 18th Jun 2012 10:47
Thanks all for your diferent solutions.

Login to post a reply

Server time is: 2026-07-08 01:56:19
Your offset time is: 2026-07-08 01:56:19