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 / Replacing an object with another

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 17th Nov 2009 19:40
Hi,

Is it possible to replace an object with another without deleting it and then loading another into the same number?

TheComet


Make the paths of your enemies easier with WaypointPro!
OldPMan
TGC Store Seller
17
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 17th Nov 2009 19:46
probably no since will appear the mistake.
(such object is already used)

forall
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th Nov 2009 20:26
You can swap limbs, so if your object was a single mesh, you could have different meshes loaded in, then swap the main limb to suit whatever mesh you want. Texture manually, and have all the objects loaded in as meshes and create them really quickly too.


Health, Ammo, and bacon and eggs!
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 17th Nov 2009 20:40
How exactly would I do this code-wise?

What I'm aiming for is a simple LOD system. If the object is at a certain distance, it should be displayed as the normal .X object, but if looked at afar, it should only be a textured plain object.

TheComet


Make the paths of your enemies easier with WaypointPro!
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th Nov 2009 22:04
Really then it's probably best to avoid switching meshes altogether. If I was you, I'd make a plain for every object and position it - then step through a certain amount each loop, and hide the high poly mesh depending on distance from camera.

Here's a little example...




Health, Ammo, and bacon and eggs!
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 17th Nov 2009 22:32
@VanB

Thanks a lot for your help. The only problem is that I wanted to avoid exactly what your example shows: 2 different objects... Would it work if I add a plain as a limb to the object and hide/show limbs? Is that what you meant with swapping limbs?

Thanks, TheComet


Make the paths of your enemies easier with WaypointPro!
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th Nov 2009 23:16
That would work too, however you should remember that with plains you really have to orientate them with the camera. I'm sure there's a snippet somewhere, that uses IanM's matrix plugin to rotate a limb to suit the camera, should be pretty usefull if you go that route.

By swapping the limbs though, I was thinking more for a permanent change - not so much LOD, as the overhead would defeat the purpose. Like if you had low poly and high poly buildings, where plains wouldn't do as good a job as they do with trees for instance. Each distance building could be done with a low poly mesh, then if and when the building get's closer it could be swapped with a higher detail mesh. There is built in LOD in DBPro now though, which would probably do a better job with varying detail meshes.


Health, Ammo, and bacon and eggs!
Sigh
20
Years of Service
User Offline
Joined: 26th Dec 2005
Location: The Big 80s
Posted: 21st Nov 2009 05:46
The way I do LOD is to create the model containing all the meshes for each LOD. Each LOD mesh is assigned its own limb. Then I figure out which one should be shown. I don't worry about swapping limbs in and out.

Keep your Hope & Change to yourself, I choose Liberty! Stop by for a chat! [IXE]Nateholio on irc.maxgaming.net:6667 #GarageGames

Login to post a reply

Server time is: 2026-06-11 07:42:57
Your offset time is: 2026-06-11 07:42:57