About Store Forum Documentation Contact



Post Reply 
Attraction
Author Message
Nikon Offline
Member

Post: #1
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 grin

Thank you very much,
Nikon
04-26-2014 10:54 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #2
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
Find all posts by this user Quote this message in a reply
Nikon Offline
Member

Post: #3
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 grin Thank you Rubeus
04-27-2014 01:08 AM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #4
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
Find all posts by this user Quote this message in a reply
Nikon Offline
Member

Post: #5
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
Find all posts by this user Quote this message in a reply
Post Reply