• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Krohm

Relationship bw graphics and collision meshes

4 posts in this topic

While in the process of fixing a bug with my system, I stumbled in an apparent limitation, albeit I'm not sure this limitation is real.

I cannot quite figure out whatever this problem is real or not so I figured out I'd probably ask you all.

 

Situation is as follows: my mesh format exports both a graphical mesh and a physics mesh. That is, each mesh resource exports a graphics and a physics mesh.

Each time the mesh is instantiated, if the instance is marked solid, a corresponding rigid body is spawned at graphical mesh location using the mesh exported physics model.

The transform used for the physics mesh is the same as the graphical mesh.

 

However, I am having a problem with this. It appears that under certain circumstances there might be the need to append a transform from graphical meshes to physics.

So far, this has been ignored. After all meshes are supposed to be authored "centered around the origin" and the physics mesh is assumed to match the graphics mesh.

I'm tempted to not provide this extra transform at all. I cannot quite figure out a case in which this would be needed. On the other side, I cannot really find a strong reason to not do that... besides noticing supporting this features needs some care.

 

Do I need to provide a graphics-to-physics transform? 

 

It appears to me that meshes requiring this feature would be not properly authored (at least according to my current standards). But I'm not sure. Opinions welcome.

0

Share this post


Link to post
Share on other sites

[quote name='Krohm' timestamp='1357138670' post='5016700']
Do I need to provide a graphics-to-physics transform?
[/quote]

I don't think that you will need this at all. Rendering is more or less only a view of the physics model and the physics model should provide everything to handle game related features (hit detection, collision detection etc.).

 

[quote name='Krohm' timestamp='1357138670' post='5016700']
I'm tempted to not provide this extra transform at all.
[/quote]

Don't add something without any requirement. It will only bloat the code  and most likely will be removed in a future version smile.png

1

Share this post


Link to post
Share on other sites

Without considering usage, I see those statements rather broad; both notions were considered prior to posting.

 

There's no requirement right now and likely will never be for some time. Shall the need arise, it will be a bug and hunted down as such. With all the consequences.

I still have to stress I do worry about being unable to support anything that is authored not origin-centered. What's worse, this works for hulls but not for boxes nor spheres. So there's quite some non-orthogonality.

 

What would happen is the follow. Consider a sphere-like object centered at (0, 1, 0) with 1 unit radius.

The spherical collision object generated instead would effectively be at (0, 0, 0).

Therefore, at runtime, the scripts would incorrectly cause the graphical mesh to float half a unit above surface.

 

I've been looking at the scripts I have here. None of them would work properly with a non-identity graphics-to-physics transform. Generic mesh manipulation would probably not work as intended and there's likely not even a way to let the script code know about such a transform.

 

Currently, the above example would be classified as incorrectly authored asset. 

I am still finding myself very uncomfortable in mandating all assets to be origin-centered. But I guess I should document this limitation with extra care, I suppose this is related with some specific usage where it makes sense.

0

Share this post


Link to post
Share on other sites

[quote name='Krohm' timestamp='1357155984' post='5016804']
What would happen is the follow. Consider a sphere-like object centered at (0, 1, 0) with 1 unit radius.

The spherical collision object generated instead would effectively be at (0, 0, 0).

Therefore, at runtime, the scripts would incorrectly cause the graphical mesh to float half a unit above surface.
[/quote]

Maybe I misunderstood you at first, but I got the same issue. I solved it by keeping the physics mesh as main game object. To properly offset other entities (effects, mesh) I can add links to the physics mesh. As example I use a floor link which would be at (0,-0.5,0) in your example and connect the mesh to this link, so that the feet of a character would be always on floor level.

Additionally the render mesh can add more links for render effects, which could be statically offset-ed or connected to a bone, I'm going as far as to connect even link to link.

 

This way I can connect objects like this

physic entity <- mesh, effect or other physics entity

mesh <- other mesh or effect

 

For me it is important to keep the visual representation separated from the game world, that is, I can run only the game with physics without any rendering going on.

 

Yes, it could be useful to map a render mesh position back to the physics position, e.g. when an animated character holds a gun and you want to represent the gun by a physics object. Still I would prefer a physics only approach to keep it simple and to prevent feedback loops (physics->render mesh->physics->render mesh=mess). E.g. a simplified (ragdoll) physics representations of the character which is simulated by the physics engine, because when the gun should interact with the world, your physics engine must be able to manipulated the rendered animation (inverse kinetics), therefore the final character animation would be based on an animation driven forward physics combined with inverse kinetics.

 

But, to be honest, this could get really messy at times, think about a character which gun is locked in a closing door and the nice character animation is falling apart due to this lock.

1

Share this post


Link to post
Share on other sites

[quote name='Ashaman73' timestamp='1357162940' post='5016840']
Maybe I misunderstood you at first, but I got the same issue. I solved it by keeping the physics mesh as main game object. To properly offset other entities (effects, mesh) I can add links to the physics mesh. As example I use a floor link which would be at (0,-0.5,0) in your example and connect the mesh to this link, so that the feet of a character would be always on floor level.
Additionally the render mesh can add more links for render effects, which could be statically offset-ed or connected to a bone, I'm going as far as to connect even link to link.[/quote]This is indeed a very useful suggestion! I have already links (I call them joints) information and I could probably use them for this purpose.

The problem is indeed compounded by the need to have kinematic rigid bodies which are looped by definition.

Nonetheless, after thinking another half a day at it, I have decided to let this go and mandate assets to be origin-centered when using box and sphere collision primitive.

Thank you very much. I've made a step forward into thinking... and I cannot make it work in my head, even supposing I can write everything needed to keep the information you suggested. My best bet is that the problem is too vague to have a decent solution so the only thing I can do is to really let everything as is... and hope this will be sufficient.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0