It looks like you're new here. If you want to get involved, click one of these buttons!
// From .h
static orxSTATUS orxFASTCALL PaintDot( const orxVECTOR *position, const orxCOLOR *color );
// From .cpp
orxSTATUS orxFASTCALL StandAlone::PaintDot( const orxVECTOR *position, const orxCOLOR *color )
{
if( position == orxNULL || color == orxNULL )
{
orxLOG("Dots are null");
return orxSTATUS_FAILURE;
}
orxOBJECT *pstDot1 = StandAlone::GetObjectByName( "Dot1" );
orxObject_SetColor( pstDot1, color );
orxObject_SetPosition( pstDot1, position );
return orxSTATUS_SUCCESS;
}
// In a collision event...
orxVECTOR bodyPosition;
orxVECTOR bodySpeed;
orxBody_GetPosition( hRecipientBody, &bodyPosition );
orxBody_GetSpeed( hRecipientBody, &bodySpeed );
orxVector_Normalize(&bodySpeed, &bodySpeed);
orxVector_Mulf(&bodySpeed, &bodySpeed, orxFLOAT(10));
orxVector_Add(&bodySpeed, &bodySpeed, &bodyPosition);
orxCOLOR color;
orxVECTOR RGB;
orxVECTOR position;
orxVector_Copy(&position, &bodyPosition);
orxVector_Set(&RGB, orxFLOAT(100), orxFLOAT(100), orxFLOAT(0));
orxColor_SetRGB (&color, &RGB);
PaintDot( &bodyPosition, &color );
orxVector_Copy(&position, &bodyPosition);
I can't see a the dot anywhere, how is that at all possible?
Comments
I don't see the problem. Weird.
Did you try to set a breakpoint, assert, or some debug trace ?
Do you have same problem in Debug and Release ?
Which compiler/OS are you using? As faistoiplaisir said, does it work in debug? Have you had a look at the disassembly when the copy function is there or not to see if there's any difference?
Otherwise for you question about Box2D debug rendering it's not implemented in orx as orx itself doesn't allow direct drawing.
I guess I could add this feature or at least implement a Box2D debug draw directly in the Box2D plugin in OpenGL, the issue being that the Box2D plugin isn't aware of the cameras (for the world->screen transformation) nor if a camera is used by more than one viewport.
I need to think a bit more on how to make this work in all cases but that would definitely a great tool to have.
Tonight I'll try to actually add the physics debug draw: I already plugged the logic with the config Physics.ShowDebug property, I just need to add the draw calls and add a centralized function to transform world coords into screen space on a per viewport basis.
The drawback with the draw primitives is that they should happen between the start of the rendering pass and its end otherwise they won't display anything.
There are events for that (orxRENDER_EVENT_START/_STOP) or people can even simply replace the rendering of a dummy object by their own code that would call them, in order to have them displayed as a certain "depth/layer".
It'll work in debug & profile modes only and will display all the debug shapes when the config property Physics.ShowDebug is set to true. (The property can be changed on-the-fly during execution.)
Here's what it looks like: