Nikon
Member
|
Attraction
Good afternoon,
I'm a beginner with Esenthel and I was testing if it was possible to have one actor attracting another, something like gravity specific to an actor (like having a character attracting objects around to him)
I disabled "world" gravity and I tried searching for a way of positioning a point with gravity instead, so that my objects would orbit around it, but was unable to find anything of sorts.
Any ideas or code snippets would be very appreciated
Thank you very much,
Nikon
|
|
04-26-2014 10:54 PM |
|
Rubeus
Member
|
RE: Attraction
Have you looked into using the physics to create a distance joint? It is flexible to give the effect it sounds like you are looking for. There's some tutorials that can get you started.
|
|
04-27-2014 01:00 AM |
|
Nikon
Member
|
RE: Attraction
That would suit me perfectly, would it work between two completely independent actors? I will start looking for that, if you can point me in the right direction I would appreciate it Thank you Rubeus
|
|
04-27-2014 01:08 AM |
|
Rubeus
Member
|
RE: Attraction
From Physics/Joints:
Joint& createDist (Actor &a0, Actor *a1, C Vec &anchor0, C Vec &anchor1, Flt min, Flt max, Spring *spring=NULL, Bool collision=false); // create distance based joint, here 'anchor0 anchor1' are in local spaces of actors
Actor a0 is the first independent object(the anchor), a1 is the latched object.
The anchors are where on the objects the invisible tether attaches.
Min and Max are how short or long it can get when stretched/compressed.
The spring object is just a container with 2 settings if you want to customize the spring factor.
Collision is for if you want the objects to react to the joint itself(bump into the tether) I believe. I'm a little murky on this because there is no comment for this variable on any of the creates, except for createBodyHinge, which does not even have a 'collision' variable("Fix me, Esenthel!").
You can also use joint.breakable(flt, flt) to determine the amount of force, torque to break away.
|
|
04-27-2014 07:45 AM |
|
Nikon
Member
|
RE: Attraction
Thank you Rubeus! I found that now and have been trying with the other types of joints as well. Unfortunately I'm not having much success but I think its lack of understanding of the methods and their parameters, but I'll keep trying different combinations until I can get a sort of orbit working.
|
|
04-27-2014 12:12 PM |
|