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 / Tank trail, following terrain's shape

Author
Message
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 29th Aug 2010 00:42
I'm working on an RTS game, and made a long list of problems to solve.

After having the tank unit to follow the ground's shape (tilting), came the idea of having a short living (~20 particles, slowly fading away with 'alpha mapping on' command) little particle system after the moving unit, which would make its trail in the sand.

On each spawn point, a particle with the trail texture is placed under the moving unit, at the same position (though lower of course to actually be on the ground..) and angle.

Everything is really sweet, but the angles/vertices of the 'trail plains' (...or particles) just won't ever match perfectly. Okay, "not perfectly" may be a little optimistic, but still it's fine now.

Well this isn't such an enormous problem with the kind of tank wheel (am i saying right?) texture i'm using, but there are certain areas on the terrain / some rotations of the unit where the result really doesn't look pro at all. And i don't want to release something not pro, with a program actually having 'pro' in its title...

So i realized, if i could reposition the rear pair of vertices to the previous 'trail plain's front pair of vertices, the whole trail could become a SEAMLESS ONE PLAIN TRAIL basically, how cool would that be! (Not talking about welding those vertices, just positioning is necessary! Not being lazy here, just it is a particle system, and i need it as a collection of multiple objects to reuse when the max particle value has been met!)

But i have never touched the subject of manipulating the vertices, could somebody help me here...

(attached a picture to ease the understanding of the problem)

ps.: please first come with built in stuff, factory DBPro commands... i don't really trust these third party stuff, they all get outdated as soon as there is a new version of the core program, and as far as i browsed the end was always like that the DLL is not free at all, or at least completely... also let this thread not become a place arguing about the things i just said about third party stuff - i see it this way sorry... - , please...
Mugen Wizardry
User Banned
Posted: 29th Aug 2010 00:47 Edited at: 29th Aug 2010 00:48
see my post here:

http://forum.thegamecreators.com/?m=forum_view&t=174450&b=1

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th Aug 2010 01:59
@Mugen
That's completely irrelevent to the problem...

@Quel
You can use "lock vertexdata for limb" on the main limb of each plain. You will then need to convert the local positions of the vertices to world positions so that you can 'snap' them together. Without an external plugin, the maths becomes rather complicated, although EZRotate can do it easily.

As an alternative to doing maths, you could create a hidden object with a limb. To convert a local position to a world position you would give the hidden object the same position and rotation as the plain, then offset the limb by the vertex position, and use 'limb position x/y/z' to get the world position.
I'm not sure how you could convert back to local coordinates with the same ease.

Anyway, once you have found a way to convert from local to world and back, it's a simple matter of converting the positions of the 2 vertices of the last plain into world coordinates, and then into local coordinates of the new plain, and using this to adjust the first 2 vertices of the new plain.

The vertexdata commands are easy enough to use to adjust the positions of the vertices. You may also want to adjust the normals in a similar way if you want it to look perfect

[b]
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 29th Aug 2010 15:16
Quote: "@Mugen
That's completely irrelevant to the problem..."

No it isn't, as you can use similar code to splat a tank track texture on the terrain. It's not an ideal solution, but it isn't irrelevant either.

My signature is NOT a moderator plaything! Stop changing it!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Aug 2010 16:16
I think BatVink posted one method a few months back. Can't recall the thread though. A search might find it.
Dia
21
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 29th Aug 2010 16:20 Edited at: 29th Aug 2010 16:21
as mobiius says, it can actually be quite handy, since you can include the 'track splatting' using the tank's rotation at the time the track is laid down. Saves you having to do any other calculations to determine how the track texture is laid down. Simply flop a plane down using the tank position and rotation and hey presto!

Admittedly it is a very simplistic method, but for terrains that are not excessively bumpy, or for a large number of tracks being laid (200+ tank rush anyone?) then it works just fine

This is not the Sig you are looking for....
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 29th Aug 2010 17:09
I think now we are getting away from what's really in question.

Plains laying down DONE, vertex manipulation NEEDED to perfect the effect.

Thank you for pointing out the command Diggsey.

Now the only problem is to deal with vertex local position vs. world position conversions...

I'm in a big problem here since right now i don't have DBP in a functioning state, so i can only plan in mind what will i do if the editor ever wishes to run again.

The main question for me right now, if somebody could check it for me, OR already knows it: when you check out a vertex's local position, is it gonna be 0,0,0 or a number above or under zero (basically the X,Y,Z distance) calculated from the pivot center of the whole object?

I think i have the solution with geometry for both cases, but the second case would be easier.

Login to post a reply

Server time is: 2026-07-23 12:09:57
Your offset time is: 2026-07-23 12:09:57