Jump to content

  • Log In with Google      Sign In   
  • Create Account

Irlan Robson

Member Since 08 May 2012
Online Last Active Today, 02:41 PM

Posts I've Made

In Topic: Apply drag to rotation

Yesterday, 05:43 PM

I think you're talking about a spherical joint. The idea is to create a constraint that will keep the objects from moving both angular and linearly towards the blue middle point in your picture. (https://github.com/irlanrobson/Bounce/blob/master/Src/Dynamics/Joints/b3SphericalJoint.cpp). Uniquely you would be creating a constraint for both spheres, apply impulses for 1 iteration, and integrate the positions and velocities after.

In Topic: Mass distribution

06 February 2016 - 02:03 PM

Randy, don't you mean:

void RigidBody::ApplyForceAtWorldPoint( v3 F, v3 point )
    m_force += F;
    m_torque += Cross( point - m_center, F );


In Topic: How do i find

05 February 2016 - 09:34 PM

and how to calculate a volume of that shape:


Code for mesh volume integration by Stan Melax: http://melax.github.io/volint.html. Since his code is not much readable I copy pasted here's my version: http://pastebin.com/MBGWQhFz. Also make sure the mesh is actually not a surface. Otherwise the code will assert.


And help us help you by renaming the thread title from "How do i find" to the actual description title of this thread.

In Topic: [Design] Meshes and Vertex buffers

02 February 2016 - 07:36 PM

So, you're asking for an architecture advice for your mesh implementation, right?


In my engine's model library I have, basically:


CVertexBuffer - topology type, strides, offsets, API specific data (this is an interface basically)

CIndexBuffer - format, index offset, API specific data

CMesh - vertices, and faces 

SHADER_PART (a simple structure) - vertex and index buffers, textures, colors

CDrawableMesh - shader parts, bounding volume(s)


Then I share a drawable mesh across mesh instances. I guess I probably shouldn't point out an ideal actor hierarchy here because it varies from engine to engine. But the basic idea (at least for static meshes) is to cache drawable meshes and not graphics buffers (e.g. don't load them more than once!).


When creating vertex/index buffers for shader parts, just after loading the meshes from a stream at initialization, I pass a structure indicating the usage flags you're talking.


- however the shader determines the required vertex attributes <-- I'm not sure what happens when the shader tries to read an attribute which is not currently bound and set properly.


Shader management was quite discussed here previously. Search on the forums. Nevertheless, I don't feel prepared for pointing out any ultimate solution for a shader system. Sorry! But AFAIK, even on your intermediate graphics framework, you definetly must have some kind of shader manager for each object type on your game (e.g. models, terrains, skeletons, etc.). 


Hope that helps.

In Topic: Resting Contact With Friction

01 February 2016 - 10:49 AM

I use a velocity based formulation, with two tangential directions (in 3D). I remove the relative tangential velocities at the contact point, enforcing lo <= Pt <= hi, where 


hi = u * Pn

lo = -hi

Pn = normal impulse

Pt = tangential impulse

u = coefficient of friction (represents both static and dynamic friction)


This way I get automatic static friction.