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 / Make a trail

Author
Message
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 19th Dec 2005 09:17 Edited at: 19th Dec 2005 22:47
Crud, this forum bugged. I tried to edit this post and it came up with my last post. Anyway, I'll retype it

How would I make a collidable trail (wall) follow the character? You know, like that racin game off Tron. I'm making my own version of it and I wanted to know how to do the trail. If you have no clue what I'm talking about. Here is an example picture:


While I have this post up, what do you guys think of my 4 viehicles so far?



smallg
Valued Member
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 19th Dec 2005 17:05
why not just use a long rectangle shape that follows the object around?
this would make it easier to workout collisions and the rest, but i suppose for more complex shapes it would look pretty poor...

life's one big game
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 19th Dec 2005 18:07
DBPro has some cool features that can arrange such things, but you can't do much with it, so I'll give some options:

You can make a trail of alot of objects, for example spheres, that are placed at time intervals when moving. However, if the trails have to be kept visible, the number of models could be very high, and causes a major slowdown.

Another possibility is, when moving straight forward, A plain is formed that stretches out with the object motion. If the object changes angle, a new plain is formed. To store the point data, I suggest you use arrays.
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 19th Dec 2005 20:50 Edited at: 19th Dec 2005 22:43
Aaah. I think I get what you're saying sven. I do like the plain ideas. It Just I don't know how to stretch it to follow the player object. Jee, I'm thinking I need to probably scrap this idea until I'm a little better idea on what I'm doing. Unless some one could write code to help me. ??? Thanks for the ideas so far guys. I'll play around with that until I get something working.

Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 19th Dec 2005 22:12
get the midpoint of the distance between the player and the turning/starting point, plase the plain there and stretch it

Don't look at my sig!
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 19th Dec 2005 22:29 Edited at: 19th Dec 2005 22:40
aah. Now let me interpret that..... So

pos= start point + end(or)turn / 2

position line pos
stretch by ???

I just don't know how to stretch it?
(I know it's scale object) I just wouldn't know what to stretch it by... Thanks for the idea. I'll play around with it and try to get it working.

While I have this post up, what do you guys think of my 4 viehicles so far?



Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 20th Dec 2005 10:25 Edited at: 20th Dec 2005 10:27
Make a plain with 100*100 size. Which means the scale object will now have 1% = 1unit in 3D-space.

To get the midpoint:
px# = (endX# + startX#) / 2
pz# = (endZ# + startZ#) / 2

and for scaling:
size# = sqrt((endX#-startX#)^2 + (endZ#-startZ#)^2)

Note: this doesn't work when you can go up and down too.
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 20th Dec 2005 17:42
Great! That works. Well sort of. It does grow, and everything. But it doesn't follow the object. Here is the code I have so far.



Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 20th Dec 2005 18:15 Edited at: 20th Dec 2005 18:31
An example:
Trails = 1

if the object moves, then it has to draw a new trail, from the last end position to the position of the player using the equations of last post. When the player turns, it becomes impossible to still create a trail because trail has to be turning. That's why we create a new trail, and start the whole process over again. (To start a new trail, just increase Trails and work with the plain object Trails.

[edit]I'll try to come up with some code.

[edit2] Even if I say it myself. I like the effect



BTW: you might want to limit the trails. It's not done in this example, but it's a good idea for preventing the game from slowing down.
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 21st Dec 2005 00:00 Edited at: 21st Dec 2005 00:11
Sweet! Thanks alot! That is exactly what I wanted. I thank you. And thanks to eveyone else. I really appreciate it! So, the wall is object 10 and up? If so, I've got alot of my game newaly finished. I just have to make another object with a trail, replace models, and collision, and add scores and what not. Sweet! Thank you!

[Edit] How can I make it trail behind him just a little bit further away? Everytime I turn, it says I would of died. Here's code:



Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 21st Dec 2005 08:35
You don't need to do that. When a player is drawing his trail, it's impossible to hit that, so you can just leave out the collision for that trail.

I did code first a program that makes a trail a bit further away in the direction of StartX#,StartZ#. But the effect you get isn't very great. It will cause "holes" in the trails instead of one big trail.

I changed to boxes, because it's easier to get collision from. (you can change the X-value of the "make object box" command to make the trail thinner):

dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 21st Dec 2005 16:48
Sweet Sven, you're the greatest. Thank you very much. Now I know who to turn to if I need help. THANK YOU!!!

KYP
20
Years of Service
User Offline
Joined: 5th May 2005
Location: 01110000
Posted: 21st Dec 2005 23:39
Sven, have you been coding since before you got a file on the forums?

That's weird, I haven't blinked for the last minute! Hmm...
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 22nd Dec 2005 04:20
Another question. How can I make the camera follow the object, but when I turn, the camera doesn't turn so suddenly as the object does?

I use this code

And when you turn the object, the camera turns so it seems like it's not turning right at all. Hope this explains something.

Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 22nd Dec 2005 08:36 Edited at: 22nd Dec 2005 18:38
Quote: "Sven, have you been coding since before you got a file on the forums?"


Yes, when I got DBC, we didn't have internet...

Quote: "Another question. How can I make the camera follow the object, but when I turn, the camera doesn't turn so suddenly as the object does?"


This means that the cam position isn't depending on the objects angle right? Just the position.
In other words, the cam pos has the same X coord, A little heigher than the Y and a little lower than the Z.

Like this:

(O is the object, C is the cam)

This is pretty easely achieved:


Or if you want a smooth camera movement:

*not tested
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 22nd Dec 2005 17:21
Yah, for some reason it (DB) doesn't like the curve value command. it says real numbers should be use and I was seeing real numbers....

Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 22nd Dec 2005 18:40
Try again. I edited it. camera position x(1) had to be camera position x(). My mistake...

Note: don't forget to type the command autocam off to prevent the camera to view every newly created object(trails remember).
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 23rd Dec 2005 04:07
sweet, how can I make it follow the object? So its behind, and above it? Oh and thank you VERY MUCH for helping me with this.

Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 23rd Dec 2005 12:44
You already posted the answer on this:



Or if you want a little more control about your camera:



Both do almost the same. Unless the command can be used for static collision and the function points towards object itself.
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 23rd Dec 2005 19:54
Sven You're the greatest. Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!

Now, do you have a website of something I can link to when I make the credits?

Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 24th Dec 2005 08:14
Nope, and I don't need credits either.

I'm here to help right?

Good luck with the game...

Sven B
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 24th Dec 2005 20:15
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 24th Dec 2005 20:24
Uhm, dabip, you should search the forums before posting a question.

Don't look at my sig!
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 24th Dec 2005 20:27
I tried. I didn't find anything. Why do you say that?? Did you find something?

Login to post a reply

Server time is: 2025-05-22 23:56:18
Your offset time is: 2025-05-22 23:56:18