Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. Unity 2017.3 has arrived! Read about it here.
    Dismiss Notice
  3. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Circular Gravity Force

Discussion in 'Assets and Asset Store' started by LaneMax, Dec 13, 2013.

  1. ataloss

    ataloss

    Joined:
    Jan 2, 2014
    Posts:
    52

    All you have to do is add the player Controller script from faux gravity to your character (see attachment). Then your character will be able to move on the planet while CFG keeps them planted on the surface..

    Hope this helps.

    upload_2016-9-17_9-13-39.png
     

    Attached Files:

  2. healym

    healym

    Joined:
    May 17, 2016
    Posts:
    19
    Is it possible to use this Mecanim? I'd like to create animation clips with this. Is that possible?
     
  3. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Yep, works great to! You can animate most of the main values like size, force power and etc, even turn it on and off
     
  4. healym

    healym

    Joined:
    May 17, 2016
    Posts:
    19
    Wow, that would be great! Sorry to reply so late, didn't know you'd respond so quickly! Do you have any tutorials that show how to use CGF with Mecanim? I think I'm ready to buy!
     
  5. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    I don't, but I've been meaning to redo a lot of the video tutorials. I could add that one to the list ;)
     
  6. The_Main_Character

    The_Main_Character

    Joined:
    May 19, 2014
    Posts:
    2
    Howdy,
    Would I be able to use this for a cubic world?
    For example in the truck demo is possible for it to have that same behavior but with a cube mesh and collider?
     
  7. SocialFreak

    SocialFreak

    Joined:
    Dec 12, 2015
    Posts:
    13
    I have been going through the tutorials and wondered if there is a way to create a tornado/hurricane type effect. Since the only shapes are Capsule, Sphere, Box and Raycast, I'm not sure how to approach this.
     
  8. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    3,999
    Maybe you could use something like this free asset and add onto it some gravity spheres? If the gravity spheres are revolving around and climbing an axis, it might create an effect like what you want.
     
  9. xagarth

    xagarth

    Joined:
    Sep 7, 2016
    Posts:
    6
    Hi,

    Great work so far!

    So what's the status for projectiles and particles for sphere worlds/planets.
    Will they bend accordingly?

    Or it's just magnet for rigidbodies.

    If I fire up projectile, a bullet, with rigidbody attached, will it go around the planet keeping distance to the ground and fall eventually?
     
  10. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Hey The_Main_Character,

    Your pretty much limited to sphere shape. You could try using the sphere shape and see what happens, my guess it'll look a little weird.
     
  11. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    If it were me I would use different combinations of CGF shapes, and force types. Check out the vortex demo scene, that might give you some ideas.

    Cheers!
     
  12. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Hey xagarth,

    Sense I'm relying on Unity's physics system it should. If you want a object to be effected you have to have a collider and rigidbody on the object in order for it to work. But for particles sadly they are not effected sense they dont have a collider and rigidbody, hope this helps.

    Cheers!
     
  13. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    381
    @LaneMax could you add a timer option to shut off CGF in particular for the explosion.. the field remains constant but should only be 1 second or so.. It would be nice to be able to customize how long the field lasts.
     
  14. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    381
    I would use a vertical 2 hollowed cylinders each shaped in a cone shape to form an hour glass with a mesh collider. Make it the size of your tornado and disable render.. then have it CGF attached below it with an upward force -maybe explosion and or pulse. I'd leave just enough room for the cylinder above ground to let objects in but maybe CGF underground. You could add more CGF Objects.. one could be angled 45 degree inside the hour glass on an angle. The idea would be that one CGF forces objects up ward with Gravitational attraction while the other CGF object above it pushes it sideways upwards on a 45 Degree angle to give the objects a spin in the hour glass. I haven't seen the Vortex demo scene so I'm not sure what might work best for the effect you're going for. The top part of the hour glass itself could have CGF added to it with force so the objects pulled up inside don't look like they are bouncing off a surface.

    One last way without the hour glass could be one CGF with gravitational attraction then several more above it spaced apart on a 75 degree angle all directing to the other CGF nodes above each other with the nodes set to gradually getting weaker as they go up.

    If you use the hour glass method you could potentially animate the physical shape with some of the vertex animators on the asset store.
     
    Last edited: Jan 5, 2017
  15. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Hey Ascensi,

    There are a few different options you can take. First would be to write a timer script that enables and disables the cgf.Enable on and off. Or what I would do is animate the CGF object using an animation + mecanim. Let me know if this helps.

    Cheers!
     
  16. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Good news! Currently I'm playing with Unity 5.6 beta and I'm able to do any shape! Once Unity 5.6 is released I will have this feature implemented and released along with it. Click the link for a preview https://twitter.com/Lane_Max/status/819441649583538176

    Cheers!
     
    hopeful likes this.
  17. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    381
    Looks great! reminds me of Super Mario World Galaxy!
     
  18. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Hey epicproblem,

    I'm currently working in parallels with Unity 5.6 beta for a big update right now. So far I have this fixed, and I'll keep you in the loop once I commit the new CGF update. I'm guessing for a time frame it'll be around when Unity 5.6 is released. Thanks for letting me know.

    Cheers!
     
    Last edited: Jan 29, 2017
  19. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    485
    Heya there! This solution works for Unity ragdolls? Requires an special setup or works on top of Unity physics layer?

    Thank you!
     
  20. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Its pretty easy, the only setup is setting it so it only effects the ragdoll rigidbodys, which is pretty easy under the filter properties. It's what I'm doing for my game =) here is a preview:

    https://twitter.com/Lane_Max/status/832500156989779969
     
    Novack likes this.
  21. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Just a FYI to everyone using Unity 5.6, you should be fine updating. You will get some untiy editor warnings, but nothing that breaks the content. I'm currently in the middle of making a pretty hefty updated, will keep the forum posted on the update.

    Cheers!
     
    Rujash, TonanBora and hopeful like this.
  22. Rujash

    Rujash

    Joined:
    Jan 3, 2014
    Posts:
    1
    Hello, is it possible to combine this asset with a RayCast based 2D physics engine like Corgi Engine from More Mountains? I'm not sure if that is what was meant by 'NonAllac' support.

    I'm expecting this asset to allow vehicles to do inverting loops and, when near the ground, have an attraction to the ground that 'breaks' when too much force is exerted. Like in F-Zero: https://forum.unity3d.com/threads/how-in-the-world-were-the-physics-in-f-zero-x-done.204747/

    EDIT: Reading back in the thread, I just noticed someone else requested something similar. I will read up on it.

    EDIT2: I just watched your tutorial for your hover car. I think I can achieve a 2D F-Zero effect if I have two hovercraft scripts acting on the same object, right? So, one hovers it upward, the other hovers it downward. I predict there'd be an issue with a discrepancy between the two hovering scripts in where they want the car to 'rest' or some other unforeseen consequence of the two interacting. This could maybe be solved by just adding an extra force downwardly on the same hoverscript, when the object is above the value (height) that the player wants.
    The only possible issue I see is that, for my purposes, the hovercraft doesn't tilt. If I don't freeze that axis though, it should probably be fine. I want this for 2D, not 3D... So, I'm wondering if the hovercraft script can be used on a 2D object. In theory, it should.
    One problem with 2D and having it tiltable is that maybe the hover script behaves weird and on 2D slopes causes my character to spaz out.

    As for 3D, the same applies, but instead of turning the hovercar, one would 'strafe' it and rotate it along with the track which its attracted to. That would work, in theory, for the invert-enabled tracks, but problems would happen if you cannot turn the car on the flat-leveled parts of the track. Figuring that out might be fun.

    EDIT3: Diagram. There are 2 options for the downward facing hover script. M1 never limits downward force in the y+ direction, but ceases acting sometime above the car. M2 is a line segment, acting only in a specific area. At the beginning of the red and magenta lines, imagine that is a point away from terrain where the downward force ceases to act. This can be achieved by extending the downward hover script's detection line further into the ground than the upward hover script's, which is why the red line is relevant. Orange line is where upward hovering script stops influencing the car. Yellow is gravity.
    [​IMG]

    I think maybe the F-Zero car doesn't collide with the track, but the car is a child of a smaller box inside it. That smaller box is what drives the car and is affected by the track bottom. Then, the detecting for normalizing the box's angle with the ground is done with a y+ projecting raycast that is horizontally between the outer shell of the car and the box,so the box never hits an oncoming ramp and the car's bigger collision box doesn't hurt its maneuverability... except when it (car shell) collides with the side of the track or with another car. Could just be a very strong hovering script, though. Or some kind of spline. It's all theorizing how the original F-Zero was done.
     
    Last edited: Apr 7, 2017
  23. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Hey Rujash,

    Thanks for the message, I'm not to familiar with the Corgi Engine, but I would guess that you would still be able to use CGF as long as you have a rigidbody2D and a collider2D on the gameobject. 'NonAllac' basically means, if you have it enabled, it will not use memory.

    Yeah as far as the hovercraft goes I'm currently in the middle of a update that will make this a lot easier. The way I was doing it back then had a lot of problems, including the axis locking which you are running into now, which really isn't the best way to solve that problem. I'm even going to have a 2D Hovercraft example in the next updated which will be coming out soon, I'll keep you posted.

    Cheers!
     
  24. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    1,466
    I need to set up gravity on a ringworld-type environment -- that is, creating the effect of centrifugal force against the spinning inner surface of a circular band (or like in a wheel space station).

    Could I do this with CGF? From the videos, looks like I'd just set up a sphere with Gravitational Attraction, with gravity set to a positive (repulsive) value from the center of the sphere....except that this would give objects a lateral push (sideways on the curved band) as well as an outward push. Is there a way to make the center of gravity linear rather than a point?

    thx
    Dave
     
    Last edited: Apr 28, 2017
  25. veven

    veven

    Joined:
    Sep 12, 2012
    Posts:
    6
    Hi, I just bought CGF last week. I'm really enjoying using it so far, but I hope you can help me with something.

    My scene has a PlanetCGF (Shape: Sphere, Force Type: Gravitational Attraction, Force Mode: Acceleration, Force Power: -1000). Then I have a PlayerCGF that is meant to make the player float when activated, the settings are (Shape: Raycast, Force Type: Force, Force Mode: Acceleration, Force Power: 10). It's pointing up through the player and works well.

    What I want to achieve is the player floating at a certain height in the air when a key is held down. So I have a CGF_Key Controls script that turns on the PlayerCGF Force, and a separate script that constrains the players rotation. So far so good.

    What I don't know, and could use your help with, is the correct setting for the PlayerCGF's Force Power to make it perfectly counteract the PlanetCGF's gravity. When I use Unity's standard gravity, setting it to 9.81 achieves what I want.

    I've narrowed it down to a value between 11 and 11.1... I think. But the behaviour is weird, and I'm not sure I'm approaching this problem from the right direction.

    Actually, is there a better setting for the values that would help me achieve the right effect? I may have to introduce some separate magic to get the right look, like a collider that stops it from moving up anymore, or a temporary script to clamp the position's maximum value. But I'd love to figure out how to achieve this effect natively with CGF, if possible.

    Perhaps there's a specific equation I could use to calculate this value for a given CGF? I looked for variables on the CGF object that might give me clues, but found nothing.

    Any help would be appreciated. Thanks. It's been a joy to use so far.
     
  26. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Hey Dave,

    Yeah that might be a pretty tough problem to solve. In my next update I do have a solution for using shapes rather then just a sphere, there is some limitations though, you can only use convex colliders, and Unitys basic primitives. You might be able to if you split the ring in to parts and set it to convex. I'll keep the forum posted when the new version with this feature comes out which is in the next update.

    Cheers!
     
  27. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Hmm yeah you might have to write a script. Maybe you could use Physics.ClosestPoint for calculate the strength of the CGF? You would have to supplying the Physics.ClosestPoint with the player's vector, and the collider of the planet to get the closest point, and use that to find the distance between the planet and the player, then use that distance value to control you CGF. Don't really know if this will help, let me know.

    Cheers!
     
  28. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
  29. healym

    healym

    Joined:
    May 17, 2016
    Posts:
    19
    Hi,

    I'm interested in making a tilting table that changes its incline based on the position of a ball. I'd like to start out with a platform that's flat with the ball in the middle. The angle of the tilt would be determined when the player hits the ball with a paddle and the ball passes through a collider. By placing these colliders around the table on all four sides I thought that possibly I could make the ball and table continue to move automatically. Can this be done?

    Also, I'd like to use this with another asset that already utilizes Unity physics (such as the ball itself). Do you think your asset would conflict with this other asset?
     
  30. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    I guess I'm having a little bit of a hard time understanding the question and how you would use the physics content. Do you have maybe a screenshot?

    As for as compatibility goes, it really depends on what the other package is doing. My content only applying Unity's physics to objects that have colliders & rigidbodys, if the other content is taking control of that, then that would be a problem.
     
  31. yamlCase

    yamlCase

    Joined:
    Apr 13, 2017
    Posts:
    18
    Lane, I really like your assets. I made a short video while evaluating SSS and CFG. This is testing out the Gravitational Attraction force.

     
  32. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Nice!
     
  33. yamlCase

    yamlCase

    Joined:
    Apr 13, 2017
    Posts:
    18
    Hi Lane, I'm attempting to access the ForcePower property using your script as a template from your March 2016 post, but something is wrong. I get NullReferenceException: Object reference not set to an instance of an object
    engine.Update () (at Assets/engine.cs:13)
    on the cgf.ForcePower = Nf; lines:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. using CircularGravityForce;
    6.  
    7. public class engine : MonoBehaviour {
    8.  
    9.     public CGF cgf;
    10.  
    11.     void Update () {
    12.         if (Input.GetKey(KeyCode.Space))
    13.             cgf.ForcePower = 2f;
    14.         else
    15.             cgf.ForcePower = 0f;
    16.     }
    17. }
    Did something change with the latest asset? BTW I'm on the CGF + SSS bundle if that makes a difference.
     
  34. yamlCase

    yamlCase

    Joined:
    Apr 13, 2017
    Posts:
    18
    Figured it out: drag which CGF I'm referring to into the script box. Thanks for being my sounding board :)
     
  35. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    lol just looking into it, was just about to say the fix ;)
     
  36. Mcg

    Mcg

    Joined:
    Mar 28, 2012
    Posts:
    97
    Great asset I'm having fun playing around with,:) I have a few questions, I was curious if a path prediction would be possible? Say for example, if I had just a plain rigidbody/2D with a set x velocity leading into a gravitational attraction sphere and seeing it's full path with the gravitational attraction manipulation.

    I see there's a directional force, however, is there a way create a circular force or a way to create something similar to newtons orbital cannon theory?

    [​IMG]

    My last question regarding gravitational attraction force mode is it possible to be able to use the force position with the height offset without objects shooting away? It works fine in force mode

    thanks :)
     
    Last edited: Aug 13, 2017
  37. Vampyr_Engel

    Vampyr_Engel

    Joined:
    Dec 17, 2014
    Posts:
    139
    Still a great product but I would like to know if you intend getting A.I to walk and run around and drive around the planets and fly to anb fro annd around in the planets level and that you could adjust in the inspector for friendly or enemy A.I Are you thinking about that per chance?
     
    Last edited: Aug 13, 2017
  38. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166

    Hey Mcg,

    The path prediction would definitive be a awesome feature to add, don't know how likely I would be for me to get it in, but I can experiment with the idea. In the mean time, you might be able to accomplish the prediction using the Physics.Simulate.

    For the Newton Orbital Cannon idea, have you tried putting a gravitational attraction around the planet? I really like the Newton Orbital Cannon concept, seems like a really good tutorial scene I could add to the package.

    Yeah the reason why the objects shoot away is because the force position location using the offset is almost like a black hole when using gravitational attraction, is there a reason you are using the height offset?
     
  39. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Hey Vampyr_Engel,

    Sadly creating AI in conjunction with a physics package a little outside the scope of what the content was designed for, but I can point you in the right duration for how I would approach the problem. I know that Unity has made some really good progress on there newer nav mesh technology and I maybe start there.
     
  40. Mcg

    Mcg

    Joined:
    Mar 28, 2012
    Posts:
    97
    I've had a go at the path prediction but not quite sure what I've got wrong

    [​IMG]

    The red circle is from the CGF2 component , the yellow line is my predicted path and the blue line is the game object trail affected by the gravitation attraction.

    I copied the ApplyCGFGravitationalAttraction function and made a duplicate with few parameter changes so I can just return the force vector3 for the prediction.

    Code (CSharp):
    1.  
    2.         public Vector3 CalculateCGFGravitationalAttraction(Rigidbody2D rigid, Vector3 velocity, Vector3 pos, Vector3 cgPos, Transform trans)
    3.         {
    4.             if (_projectRight || _shape2D == Shape2D.Raycast)
    5.             {
    6.                 Vector3 gravitationalAttraction = (trans.right).normalized * rigid.mass * ForcePower / (trans.right).sqrMagnitude;
    7.  
    8.                 if (float.IsNaN(gravitationalAttraction.x) && float.IsNaN(gravitationalAttraction.y) && float.IsNaN(gravitationalAttraction.z))
    9.                 {
    10.                     gravitationalAttraction = Vector3.zero;
    11.                 }
    12.                 return gravitationalAttraction - (VelocityDamping * velocity);
    13.             }
    14.             else
    15.             {
    16.                 Vector3 gravitationalAttraction = (pos - cgPos).normalized * rigid.mass * ForcePower / (pos - cgPos).sqrMagnitude;
    17.                 if (float.IsNaN(gravitationalAttraction.x) && float.IsNaN(gravitationalAttraction.y) && float.IsNaN(gravitationalAttraction.z))
    18.                 {
    19.                     gravitationalAttraction = Vector3.zero;
    20.                 }
    21.                 return gravitationalAttraction - (VelocityDamping * velocity);
    22.             }
    23.         }
    24.  
    And heres my code that I use to test
    Code (CSharp):
    1.  
    2.  public CGF2D[] cgf2dList;
    3.  public Rigidbody2D rbody;
    4.  public Vector2 vel = new Vector2(150, 0);
    5.  
    6.     private void OnClick()
    7.     {
    8.  
    9.         var colour = Color.red;
    10.         Vector3 velocity = vel;
    11.         Vector3 currentPosition = transform.position;
    12.         Vector3 nextPos;
    13.         var closestPlanet = GetClosest(cgf2dList, currentPosition);
    14.  
    15.         for (float i = 0; i < estimateTime; i += Time.fixedDeltaTime)
    16.         {
    17.             nextPos = currentPosition + Time.fixedDeltaTime * velocity;
    18.             Debug.DrawLine(currentPosition, nextPos, Color.yellow, 10);
    19.             currentPosition = nextPos;
    20.             var force = (closestPlanet.CalculateCGFGravitationalAttraction(rbody, velocity, currentPosition, closestPlanet.transform.position, transform));
    21.             velocity += (force) / Time.fixedDeltaTime;
    22.         }
    23.      }
    24.  
    25.     private CGF2D GetClosest(CGF2D[] cgf2ds, Vector2 pos)
    26.     {
    27.         CGF2D closest = null;
    28.         float closestDistanceSqr = Mathf.Infinity;
    29.         Vector3 currentPosition = pos;
    30.         foreach (CGF2D potentialTarget in cgf2ds)
    31.         {
    32.             Vector3 directionToTarget = potentialTarget.transform.position - currentPosition;
    33.             float dSqrToTarget = directionToTarget.sqrMagnitude;
    34.             if (dSqrToTarget < closestDistanceSqr)
    35.             {
    36.                 closestDistanceSqr = dSqrToTarget;
    37.                 closest = potentialTarget;
    38.             }
    39.         }
    40.         return closest;
    41.     }
     
    Last edited: Aug 17, 2017
  41. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Wow its looking prertty interesting! If I get some time this weekend I'll try playing around with it, do you have any drag on the objects?
     
  42. Mcg

    Mcg

    Joined:
    Mar 28, 2012
    Posts:
    97
    I've turned off drag and gravity but it could be added, I've got it to be somewhat accurate now but it's not always 100% my maths isn't that great :D

    [​IMG]

    Here's the code I changed

    Code (CSharp):
    1.  
    2.     private void OnClick()
    3.     {
    4.         var colour = Color.grey;
    5.         Vector3 velocity = vel;
    6.         Vector3 currentPosition = transform.position;
    7.         Vector3 nextPos;
    8.         var closestPlanet = GetClosest(cgf2dList, currentPosition);
    9.         Vector3 force = (vel / rbody.mass) * Time.fixedDeltaTime;
    10.         for (float i = 0; i < estimateTime; i += Time.fixedDeltaTime)
    11.         {
    12.             nextPos = currentPosition + Time.fixedDeltaTime * force;
    13.             var insideCircle = intersect(nextPos, GetComponent<BoxCollider2D>(), closestCgf2d.transform.position, closestCgf2d.Size);
    14.  
    15.             if (insideCircle)
    16.                 colour = Color.black;
    17.  
    18.             Debug.DrawLine(currentPosition, nextPos , colour , estimateTime);
    19.             currentPosition = nextPos;
    20.  
    21.             if (insideCircle)
    22.             {
    23.                 Debug.DrawLine(currentPosition, nextPos , colour, estimateTime);
    24.                 force = force + ((closestPlanet.CalculateCGFGravitationalAttraction(rbody, velocity, currentPosition, closestPlanet.transform.position, transform) / rbody.mass) * Time.fixedDeltaTime);
    25.                 velocity = (force) / Time.fixedDeltaTime;
    26.             }
    27.         }
    28.     }
    29.  
    30.     bool intersect(Vector2 boxPos, BoxCollider2D boxCol, Vector2 circlePos, float circleRadius)
    31.     {
    32.         float cx = Mathf.Abs(circlePos.x - boxPos.x - boxCol.size.x / 4);
    33.         float xDist = boxCol.size.x / 4 + circleRadius;
    34.         if (cx > xDist)
    35.             return false;
    36.         float cy = Mathf.Abs(circlePos.y - boxPos.y - boxCol.size.y / 4);
    37.         float yDist = boxCol.size.y / 4 + circleRadius;
    38.         if (cy > yDist)
    39.             return false;
    40.         if (cx <= boxCol.size.x / 4 || cy <= boxCol.size.y / 4)
    41.             return true;
    42.         float xCornerDist = cx - boxCol.size.x / 4;
    43.         float yCornerDist = cy - boxCol.size.y / 4;
    44.         float xCornerDistSq = xCornerDist * xCornerDist;
    45.         float yCornerDistSq = yCornerDist * yCornerDist;
    46.         float maxCornerDistSq = circleRadius * circleRadius;
    47.         return xCornerDistSq + yCornerDistSq <= maxCornerDistSq;
    48.     }
    49.  
    This is a scenario where its inaccurate maybe the intersect function is slightly off I'm not sure , thanks if you do get the time to have a look :)

    [​IMG]
     
    Last edited: Aug 18, 2017
  43. Vampyr_Engel

    Vampyr_Engel

    Joined:
    Dec 17, 2014
    Posts:
    139
    OK thank you very much
     
  44. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Wow this is really amazing work! Hmm yeah its hard to say why it would be off by just a sliver, it almost seems like it might be off by a frame or something.
     
  45. ArthlianBtlMnky

    ArthlianBtlMnky

    Joined:
    Aug 15, 2017
    Posts:
    1
    Will this support Unity 2017 anytime soon?
     
  46. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Yep it's currently compatible with 2017 and fully supported
     
    Last edited: Sep 6, 2017
  47. broesby

    broesby

    Joined:
    Oct 14, 2012
    Posts:
    104
    Excellent asset ;)

    Anyone have tips on how to try to simulate thermal upwinds as used by glider planes and so on. A simple example looks like this:

    [​IMG]

    More complex...

    [​IMG]

    Most complex...

    [​IMG]


    The simplest version would be a capsule with a vertical force... Which type of force should it be for a rigidbody floating in upward moving air currents??

    Preferably the force should have circular motion, but still overall vector up... This is not absolutely necessary..

    More important is that it should be patchy, more or less turbulent and in a perfect world stronger in the center than on the edge... Possibly leaning sideways but force still pointing upwards.. :cool:

    Anyone tried stuff like this with CGF?? :rolleyes:

    Best wishes, Jesper, Denmark
     
  48. AntonieB

    AntonieB

    Joined:
    Apr 9, 2013
    Posts:
    6
    I'am currently trying to implement some basic control for a moonlander / rocket pilot like game like: this


    That tutorial is I guess using some very old version of CGF and all the scripts are not available for using the axis control / keycontrols.

    I need to use a script to control the forces / rotation of the rocket and i'm not exactly sure on what is the correct way to do this. any tips?
     
  49. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    166
    Hey AntonieB,

    If you have the newest version of the CGF package, you can checkout that Rocket scene and see how its setup. You have the newest version?