Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing attachShape()/detachShape() #10

Open
ghost opened this issue Sep 1, 2014 · 11 comments
Open

Missing attachShape()/detachShape() #10

ghost opened this issue Sep 1, 2014 · 11 comments
Assignees

Comments

@ghost
Copy link

ghost commented Sep 1, 2014

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(...)???

@steenhother
Copy link

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?

@stilldesign
Copy link
Owner

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.

@steenhother
Copy link

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//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


@stilldesign
Copy link
Owner

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

@steenhother
Copy link

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

@stilldesign
Copy link
Owner

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.

@steenhother
Copy link

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//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
Copy link

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//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
Copy link

… 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//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


@Pysassin
Copy link

Pysassin commented Mar 7, 2018

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.

@stilldesign
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants