PhysX.Net icon indicating copy to clipboard operation
PhysX.Net copied to clipboard

Missing attachShape()/detachShape()

Open ghost opened this issue 11 years ago • 11 comments

The Methodes attachShape(...) and detachShape() are missing in the class RigidActor.

BTW-> is it possible to add a shape to actors shapelist with the method attachShape(...)???

ghost avatar Sep 01 '14 14:09 ghost

Hi Chad

Is it a big task to support the detaching and attaching of shapes? I have tried to make a "hack" in my application to overcome this lack of functionality in the wrapper (moving shapes between actors were supported in 2.8) but it becomes too complicated and unpredictable.

Is there any way I can help in this matter because I would really appreciate if this could be fixed. ...I am guessing that it is complicated in the wrapper as well since you have not already added the code for it?

steenhother avatar Aug 19 '15 06:08 steenhother

Hey, apologies for the late reply, I've been on holiday again :P Attaching and detaching shapes as far as I can remember wasn't too hard to get working, except it had 1 particular problem that I couldn't figure out. I'll need to revisit the problem, as it's kind of a useful feature. I'm trying to remember exactly what the problem was... I think was something in the area of disposing a shape. I'll have a look into it tonight after work.

stilldesign avatar Aug 25 '15 13:08 stilldesign

Thanks.

Hope you have had a good vacation The problem is that I want to deattach a shape from one actor and attach it to another actor (that already contains one or more shapes). And again deattach the shape and attach it to the original actor.

Tell me if I can be of any help.

/Steen

Den 25/08/2015 kl. 15.33 skrev Chad Mellor <[email protected]mailto:[email protected]>:

Hey, apologies for the late reply, I've been on holiday again :P Attaching and detaching shapes as far as I can remember wasn't too hard to get working, except it had 1 particular problem that I couldn't figure out. I'll need to revisit the problem, as it's kind of a useful feature. I'm trying to remember exactly what the problem was... I think was something in the area of disposing a shape. I'll have a look into it tonight after work.

— Reply to this email directly or view it on GitHubhttps://github.com/stilldesign/PhysX.Net/issues/10#issuecomment-134586644.


This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com



This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com


steenhother avatar Aug 25 '15 13:08 steenhother

Hey, I've done some work regarding attaching and detaching shapes, check out the 'DetachShape' branch and let me know if it's working for you and if there's anything missing/buggy :)

If you need, I can send you a built DLL if you have trouble building the branch

stilldesign avatar Sep 05 '15 18:09 stilldesign

THANKS!!! I have just tried it - but I am still not sure if I am using the methods correctly (or maybe I do not understand how to use them). When I am calling the DetachShape method the shape becomes disposed - I would have expected by calling AttachShape on a different actor that I could have attached the same shape again (but this time to different actor then the one used to create the shape) /Steen

steenhother avatar Sep 07 '15 07:09 steenhother

There's two ways to create Shape's now, actor.CreateShape() and physics.CreateShape()

If an actor is created on an actor (actor.CreateShape()), and you DetachShape(), it will be disposed of immediately If an actor is created on a physics instance (i.e. a shared shape) you can attach it to an actor, then detach it, then attach it to another actor.

stilldesign avatar Sep 08 '15 23:09 stilldesign

Hi Cha …ok great I will try that!

Thanks!

Fra: Chad Mellor [mailto:[email protected]] Sendt: 9. september 2015 01:44 Til: stilldesign/PhysX.Net [email protected] Cc: Steen Hother Jensen [email protected] Emne: Re: [PhysX.Net] Missing attachShape()/detachShape() (#10)

There's two ways to create Shape's now, actor.CreateShape() and physics.CreateShape()

If an actor is created on an actor (actor.CreateShape()), and you DetachShape(), it will be disposed of immediately If an actor is created on a physics instance (i.e. a shared shape) you can attach it to an actor, then detach it, then attach it to another actor.

— Reply to this email directly or view it on GitHubhttps://github.com/stilldesign/PhysX.Net/issues/10#issuecomment-138732627.


This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com



This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com


steenhother avatar Sep 09 '15 05:09 steenhother

Hi Chad

I still not works for me – sorry!

When I am creating a shape using the physics.CreateShape method and then calling the PhysX.DefaultSimulationFilterShader.SetGroup method then I get this error:

(InvalidParameter) NpShape::setSimulationFilterData: shared shapes attached to actors are not writable.( ....\PhysX\src\NpShape.cpp - Line 440

/Steen

Fra: Chad Mellor [mailto:[email protected]] Sendt: 9. september 2015 01:44 Til: stilldesign/PhysX.Net [email protected] Cc: Steen Hother Jensen [email protected] Emne: Re: [PhysX.Net] Missing attachShape()/detachShape() (#10)

There's two ways to create Shape's now, actor.CreateShape() and physics.CreateShape()

If an actor is created on an actor (actor.CreateShape()), and you DetachShape(), it will be disposed of immediately If an actor is created on a physics instance (i.e. a shared shape) you can attach it to an actor, then detach it, then attach it to another actor.

— Reply to this email directly or view it on GitHubhttps://github.com/stilldesign/PhysX.Net/issues/10#issuecomment-138732627.


This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com



This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com


steenhother avatar Sep 10 '15 05:09 steenhother

… and one more thing:

Can I suggest to use TryGetObject in the ToManage method in the TriggerPair class instead of just GetObjects: Otherwise you will get an exception when you are disposing an actor that are inside a trigger!

[cid:[email protected]]

/Steen

Fra: Chad Mellor [mailto:[email protected]] Sendt: 9. september 2015 01:44 Til: stilldesign/PhysX.Net [email protected] Cc: Steen Hother Jensen [email protected] Emne: Re: [PhysX.Net] Missing attachShape()/detachShape() (#10)

There's two ways to create Shape's now, actor.CreateShape() and physics.CreateShape()

If an actor is created on an actor (actor.CreateShape()), and you DetachShape(), it will be disposed of immediately If an actor is created on a physics instance (i.e. a shared shape) you can attach it to an actor, then detach it, then attach it to another actor.

— Reply to this email directly or view it on GitHubhttps://github.com/stilldesign/PhysX.Net/issues/10#issuecomment-138732627.


This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com



This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com


steenhother avatar Sep 10 '15 10:09 steenhother

Don't mean to necro an old issue. But was this feature abandoned? Would be nice to have but haven't seen any mention of it and it isn't in the current NuGet package.

Pysassin avatar Mar 07 '18 20:03 Pysassin

Currently only the AttachShape method is there (RigidActor.AttachShape)

What's needed is -

  • RigidActor.DetachShape
  • Physics.CreateShape to create an 'orphaned' shape which can be attached at a later stage

It's been awhile since I've looked at this topic, I can't quite remember what the trouble was with DetachShape, but there must have been something tricky otherwise I would have done it by now. I assume something around object-tracking and ownership of the object.

stilldesign avatar Mar 08 '18 22:03 stilldesign