About Store Forum Documentation Contact
Donations:
178$/mo



Post Reply 
[Solved] ctrl.actor.sweep([...]) not working ?
Author Message
KraaxLeNain Offline
Member

Post: #1
[Solved] ctrl.actor.sweep([...]) not working ?
Hi everyone,

The fat dwarf (me) is back in his holly quest of finding the endless cup of beer mastering EE Physics...

I've tried today to use the ctrl.actor.swep() function (for a Chr object) in order to manage collision preventing.

It seems that the function is not working (besides, you can't choose specific AG_actor to collide with... whereas you can with other sweep functions).

The regular sweep function works.

Not working code (no collision never occure)
Code:
temp_move=current_direction.x0z(); //Some vector pointing my move way
temp_move.setLength(raycast_length*4); //Raycast_length is homemade variable, here radius *2.
capsule_sweep_result=ctrl.actor.sweep(temp_move, &hit_capsule); //Not working : collision never occure


Working code (basic sweep test recreating the capsule).
Code:
temp_move=current_direction.x0z(); //Some vector pointing my move way
temp_move.setLength(raycast_length*4); //Raycast_length is homemade variable, here radius *2.

Capsule tempcaps; //Creatig a temp capsule, same as ctrl
tempcaps.r=ctrl.radius();
tempcaps.h=ctrl.height();
tempcaps.pos=ctrl.center();
capsule_sweep_result=Physics.sweep(tempcaps, temp_move, &hit_capsule, IndexToFlag(AG_PLAYER)); //This works


If it's not a bug and I'm doing it wrong, please point it out so I can edit the post title and learn of my posibly dummie mistake or misunderstanding.

Have a nice day all !
(This post was last modified: 02-11-2014 12:39 AM by KraaxLeNain.)
02-09-2014 11:42 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: [Bug ?] ctrl.actor.sweep([...]) not working ?
Hi, the sweep test may not detect actors which the other actor is already colliding/intersecting with.

What I do is the same as you, get the Capsule shape, but I go even furthere, decrease its radius, to make sure that I'll get the collisions that are already in contact with the actor.
02-09-2014 09:42 PM
Find all posts by this user Quote this message in a reply
KraaxLeNain Offline
Member

Post: #3
RE: [Bug ?] ctrl.actor.sweep([...]) not working ?
The weird thing is that collision never occurs... And I'm checking target like 10 radius ahead so I'm not colliding with them already !

I have 0 collision response with the ctrl.actor.sweep ... So if the sufunction is doing the same i'ts a weird thing grin

Besides, if you go check that function, adding Ag_Controller choice could be nice.

Thanks for the quick answer.
02-09-2014 10:17 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: [Bug ?] ctrl.actor.sweep([...]) not working ?
Thanks, I'm testing Actor.sweep right now
02-09-2014 11:30 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: [Bug ?] ctrl.actor.sweep([...]) not working ?
Thanks, there was a minor issue in the codes for Actor.sweep/cuts methods, I've fixed it and will work okay in next release.
02-10-2014 12:02 AM
Find all posts by this user Quote this message in a reply
KraaxLeNain Offline
Member

Post: #6
RE: [Bug ?] ctrl.actor.sweep([...]) not working ?
Good,

I'll keep my quickfix until then and test it in the next release.

Thx Gregorz !
02-10-2014 09:47 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: [Will be fixed next release] ctrl.actor.sweep([...]) not working ?
Hi, the fix was released on yesterday's update.
02-10-2014 09:17 PM
Find all posts by this user Quote this message in a reply
KraaxLeNain Offline
Member

Post: #8
RE: [Will be fixed next release] ctrl.actor.sweep([...]) not working ?
What can I say Gregorz, you're too fast for me ! I can't keep up the pace with support wink

More seriously, I'm updating the post right now.

I've tested it. Collision is working but (there is always a but) now it's also colliding with the ground (haha !) witch can be problematic when you are on merely hilly ground right ? (like up /down /up/ down again ... ... ...)

One picture atached.

Well this should not be a major issue (since I can do it another way) but would you mind considering this enhancement ? :
Initial
Bool sweep(C Vec &move, PhysHit *phys_hit=NULL )C;
Changed to :
Bool sweep(C Vec &move, PhysHit *phys_hit=NULL , UInt groups=~0 )C;

As in :
static Bool sweep(C Capsule &capsule, C Vec &move, PhysHit *phys_hit=NULL, UInt groups=~0);
(and basicly every of your colliding functions)

Adding the Uint groups will add better control and mak function more usable I think, and if it's based on the sweep function wouldn't cost much.

Anyway, I mark this one as solved and wish you a good day !

PS : Screenshot of the collided ground... (Watch the red vector. Only appears on positive slopes (since I don't set the z in my method).)
[Image: 79669_Sans_titre.png]

And if you ever wonder why my character is naked : feel free to give a hint to the big guy (it's a real show stopper for us and we'd like to share some of our game with the community one day when we will not be all naked and ashamed grin).
(This post was last modified: 02-11-2014 12:40 AM by KraaxLeNain.)
02-11-2014 12:33 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: [Solved] ctrl.actor.sweep([...]) not working ?
Quote:Initial
Bool sweep(C Vec &move, PhysHit *phys_hit=NULL )C;
Changed to :
Bool sweep(C Vec &move, PhysHit *phys_hit=NULL , UInt groups=~0 )C;
Will be added in next release.
02-11-2014 01:11 AM
Find all posts by this user Quote this message in a reply
Post Reply