Hi there,
Got several question about Physics, because behavior is not crystal clear for my right now and I'd like to understand exactly how it works to use it the right way.
1) PhysCallback:
How physic wall backs exactly works ? You set it up in main trhread and it is processed in the next physic thread and then disabled ?
For instance I puted this code in my Chr Update :
Code:
if(!has_reached_waypoint)targeted_waypoint.cuts(targeted_waypoint_trigger);
And the callback does this :
Code:
struct TargetedWaypointTrigger : PhysCutsCallback /
{
virtual Bool hit(ActorInfo &actor_info)
{
if(actor_info.obj)
{
[some tests]
{
<something stopping the Chr>
tempChr.has_reached_waypoint=true;
Log(S+"You found me ! \n ");
}
}
}
return true;
}
};
It works fine but I have a delay stopping the character... At low speed it's barely noticable if I use "extreme" stop methods but at high speed the collided object is often pass before stopping even with this methods.
Nota : I would not use high speeds for my game but use for testing robustness, since I had issues of missing stops with low perf computers.
So I need to know : does thing in the callback processed during the physics (it's the point of callbacks nhé ?) and shall be done immediatly or are they done when the ".cuts" is invoked ?
2) Stopping a chr:
I'd like to stop immediatly a character on a certain event. At some point it oftens "slide" when using "stop move" or "action break" methods.
I've tried this :
ctrl.actor.freezePos() : Does not give a far much better result...
tempChr.input_move=0; That's giving the best result I could get if I pull it right into the previously discussed trigger (but is it a bad thing ? Documentation says it's really really bad habbit to do things in the trigger
)
Anyway I could never achieve a straight block like I can have if I activate collision (but fr some reason I don't want to) ! Is there a better way to stop my char ?
3) Disabling actor group :
I've put this line in my code on inting the game :
Code:
Physics.ignore(IndexToFlag(AG_PLAYER),IndexToFlag(AG_NPC), true);
I don't notice any difference the two bojects of this kind still collide >_<
Is it normal ? What am I forgetting ?
Edit : Error was using IndexToFlag : Unnecessary >_<
4) Stop collision :
When colliding with an NPC or when they collide with me one is getting pushed (me or them). I'd like to straight stop both. I may do a workaround with a trigger to proceed during any collision (I've also seen quickfix done by others in this forum) but I'd like to prevent pushing in a cleaner way.
Is there any clean tools to say "this actor should not be pushed" ?
I've tested setting gravity to 0 (infinite) when a character stop moving... Did not worked all the time (but seems to work some cases... Weird).
5) Consider specific actor :
Code:
Actor& ignore ( Actor &actor, Bool ignore=true) ; /
If I make an object ignoring one whole CollisionGroup (AG_Player for instance) and then set that to false for a specific player. Would that player report collision despite the actor group ignoring ?
Have a nice day all !