Jump to content
The Dark Mod Forums

Where would I start if I wanted to move an entity down on the Z plane?


Recommended Posts

So I'm not looking forward to moving 1800 trees by hand, sooooo where can I start in the code? Any pointers?

I was thinking of a function that dropped just a single entity that's selected down on the Z plane until it encounters anything. Patches, brushes, other entities.

 

Any help would be appreciated.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

Define what you mean by "encounter anything". That's the tricky part in the first place, as DarkRadiant doesn't keep a collision world to detect intersections between objects. You would have to cycle over all planes of all objects in the scenegraph to test the vertices of the moved object against collisions. A simple bounding box check wouldn't give you satisfying results, as you would have to still manually tweak the trees after such an operation.

 

Another problem is that there are no methods available for you to retrieve the vertices of a model entity, which means you can't iterate over them, unless this interface is exposed somewhere. Only the bounds are available.

 

I'm not sure at all whether this is a suitable task to get started coding in DarkRadiant. :unsure:

 

At any rate, you'd need to define a new command and register this "event" in the EventManager class, so that you can assign a shortcut or menu item to it. There are a lot of commands registered in the last third of mainframe.cpp file, in case you need an example.

Link to comment
Share on other sites

Define what you mean by "encounter anything". That's the tricky part in the first place, as DarkRadiant doesn't keep a collision world to detect intersections between objects. You would have to cycle over all planes of all objects in the scenegraph to test the vertices of the moved object against collisions. A simple bounding box check wouldn't give you satisfying results, as you would have to still manually tweak the trees after such an operation.

 

Another problem is that there are no methods available for you to retrieve the vertices of a model entity, which means you can't iterate over them, unless this interface is exposed somewhere. Only the bounds are available.

 

I'm not sure at all whether this is a suitable task to get started coding in DarkRadiant. :unsure:

 

At any rate, you'd need to define a new command and register this "event" in the EventManager class, so that you can assign a shortcut or menu item to it. There are a lot of commands registered in the last third of mainframe.cpp file, in case you need an example.

 

Exactly what I was looking for thanks :wub:

Well this would only be useful if entities such as models could "detect" another object. Now a bounding box for a table would probably be fine though as you would want to place objects on it's flat surface, which the bounding box would reflect. I was also thinking more like using the origin of the models themselves as the point of reference.

 

Anyways I'll start on that tonight.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

Exactly what I was looking for thanks :wub:

Well this would only be useful if entities such as models could "detect" another object. Now a bounding box for a table would probably be fine though as you would want to place objects on it's flat surface, which the bounding box would reflect. I was also thinking more like using the origin of the models themselves as the point of reference.

 

Anyways I'll start on that tonight.

 

If your code encounters moveables (and the user tries to move a moveable down), it should actually be using the collison model because that is what the physics engine would use for collisions. Otherwise, the two moveables clip into each other at map start with unpredictable things happening when you touch then (usually one falls through the other).

 

Setting a func_static on a moveable would be the same.

 

(This brings up the old issue that many of our objects have collision meshes sticking out of their visual meshes, meaning you can f.i. never stack two books ontop of each other without them either clipping into each other, or one of them floating above the other. Which looks espeaciallyy bad when light shines through the crack or the player crouches and can look through. But I digres :)

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

(This brings up the old issue that many of our objects have collision meshes sticking out of their visual meshes,

 

There are lost of cases where the cm can't mimic the visible mesh because it's too complex. Nothing can be done about that. If there are just bad cms, however, they can and should be fixed. Just bring them to my attention.

Link to comment
Share on other sites

There are lost of cases where the cm can't mimic the visible mesh because it's too complex. Nothing can be done about that. If there are just bad cms, however, they can and should be fixed. Just bring them to my attention.

 

The ones I remember off hand are the books, tomes and crates. You can easily check them out in DR for yourself by adding the model to an empty map, then enable the CM view (e.g. disable its filtering out), then zoom in and see if the CM sticks out of the visual or not (enabling/disabling CM view makes it easier to see).

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

The ones I remember off hand are the books, tomes and crates.

 

I checked all the books that were pointed out to me earlier; they are all flush with the visual mesh. I modified one of the crates but the others are fine.

Link to comment
Share on other sites

You would have to cycle over all planes of all objects in the scenegraph to test the vertices of the moved object against collisions.

 

Yeah I was just poking around the Scenegraph code looking for just this, I don't mind if the entire operation takes several seconds to complete, it doesn't need to be instant.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
    • The Black Arrow

      Hope everyone has the blessing of undying motivation for "The Dark Mod 15th Anniversary Contest". Can't wait to see the many magnificent missions you all may have planned. Good luck, with an Ace!
      · 0 replies
×
×
  • Create New...