Jump to content
  • Advertisement

Mirko Rossetti

Member
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Mirko Rossetti

  • Rank
    Member

Personal Information

  • Interests
    DevOps
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Mirko Rossetti

    Check Collision in advance

    Actually i doesn’t have any udea to how do it.
  2. Mirko Rossetti

    Check Collision in advance

    Yes, you mean the coordinate surfaces right?
  3. Mirko Rossetti

    Check Collision in advance

    i'm sorry i can't get it
  4. Mirko Rossetti

    Check Collision in advance

    thank's for your advice, i really appreciate it. actually the problem is that i'm adjusting Y with it, but when i have some kind of downhill i'll get a strange movement like this in black the downhill, in green my character movement, actually he's going top rotate of 15 degrees because i'm setting the rotation of it by the rotation of the actual plane on the x axis. i can't figure out why it's happening it.
  5. Mirko Rossetti

    Check Collision in advance

    yes i know...i'm sorry for that stupid question, actually i solved it by doing this public bool IsBetween(double testValue, double bound1, double bound2) { return (testValue >= Math.Min(bound1,bound2) && testValue <= Math.Max(bound1,bound2)); } then, about the position relative to the plane gameobject, i choosed this way private void SetupPlane() { _planeRInverse = new Quaternion[planeArray.Length]; for (int i = 0; i < planeArray.Length; i++) { _planeRInverse[i] = Quaternion.Inverse(planeArray[i].rotation); } } private void CheckPosition() { Vector3 playerPos = _pvotPlayer.transform.position; Vector3 v1; for (int i = 0; i < planeArray.Length; i++) { v1 = playerPos - planeArray[i].position; Vector3 lv1 = _planeRInverse[i] * v1; float scaleX = planeArray[i].localScale.x; float scaleY = planeArray[i].localScale.z; float vh = 5f * scaleX; float vf = 5f * scaleZ; if ( IsBetween(lv1,0.0f - vh,0.0f + vh) && IsBetween(lv1,0.0f - vf,0.0f + vf) { //do stuff } } } with this i was able to detect the exact position of my player inside a plane, now what i should do it's to project the velocity and get if a certain amount of time it will be inside or not, it's just moving forward so it should be easy i think.
  6. Mirko Rossetti

    Check Collision in advance

    Well i figured out how to get the corner vector of each “plane” i think that this should be correct.. private void SetupPlane() { _planeRInverse = new Quaternion[planeArray.Length]; for (int i = 0; i < planeArray.Length; i++) { _planeRInverse[i] = Quaternion.Inverse(planeArray[i].rotation); } } private void CheckPosition() { Vector3 playerPos = _pvotPlayer.transform.position; Vector3 v1; Vector3 FL,FR,BL,BR = Vector3.zero; for (int i = 0; i < planeArray.Length; i++) { v1 = playerPos - planeArray[i].position; Vector3 lv1 = _planeRInverse[i] * v1; GetCornerPosition(planeArray[i],out FL,out FR,out BL,out BR); } } private void GetCornerPosition (Transform _object,out Vector3 FL,out Vector3 FR,out Vector3 BL,out Vector3 BR) { FL = _object.localPosition + _object.forward * _object.localScale.z * 0.5f - _object.right * _object.localScale.x * 0.5f; FR = _object.localPosition + _object.forward * _object.localScale.z * 0.5f + _object.right * _object.localScale.x * 0.5f; BL = _object.localPosition - _object.forward * _object.localScale.z * 0.5f - _object.right * _object.localScale.x * 0.5f; BR = _object.localPosition - _object.forward * _object.localScale.z * 0.5f + _object.right * _object.localScale.x * 0.5f; } Now i should check if my player is inside that x and z value. But some plane have a negative value..
  7. Mirko Rossetti

    Check Collision in advance

    hello! i posted the same question in the programming section but it was my mistake because i'm a beginner, right now i know a bit of c# and i'm using unity for everythings, by doing much practice i'm trying to study how to program without the unity editor, i'm too far from my target but i'll do my best. this is what i'm looking to do : i have to check in advance if my gameobject will fall off the ground after a certain distance, for example i'll attach here a screenshot to be more clear, asl you can se if my gameobject is continue moving forward will fall of the ground, what i want to do is check in advance it then change some stuff to avoid it. someone know how to do it and can help me? thank's you in advance and sorry for my bad english.
  8. Mirko Rossetti

    Check Collision in advance

    actually i'm trying to figure out how to detect the wall border but i can't still find a way....someone can show me some example ? i'm a beginner, and i saw a space for beginners in this forum only now, it's my fault. i'm sorry, i'll post my question there.
  9. Mirko Rossetti

    Check Collision in advance

    i see, actually is my target, right now i'm starting to do stuff without unity components, then i'll try to go without unity, and use it just for test...
  10. Mirko Rossetti

    Check Collision in advance

    thenks you! maybe i got it, i'll try to do it and let you know the results by reply on this post. actually to get the character position on the plane i'm using this method, is the best way to accomplish it? float fixedY; Vector3 playerPos = new Vector3 ( 0.0f, 0.0f,transform.position.z); Vector3 planePos = new Vector3 (0.0f,0.0f,plane.transform.position.z); float distance = Vector3.Distance(playerPos,planePos); if (distance <= 1) { fixedY = plane.transform.position.y + 0.1f; transform.position = new Vector3(transform.position.x,fixedY,transform.position.z); }
  11. Mirko Rossetti

    Check Collision in advance

    thank's you for your reply! so, maybe i got it. in my case i should chose a point in a certain distance from my object on it's forward direction, now i have to project my speed to that "poin" to let it simple i'lkl call it "p', so i'll get in how many time it reach the target, then the problem is... for example, as you can see from the picture that i attached before, there is no 'wall' my object will move only in a plane space, how i can detect if there is a plain in a certain p point or not? right know i can let move my object on a plane, by getting the distance between the plane and my object on the Z axis, then set the the position of my object by getting the closes z axis plane Y then add some value to it, but it's not so accurate if the scale of the plane will change, so i'm also looking a diferent way to accomplish it. i hope that i was understandable.. thank's you again for your help!
  12. Mirko Rossetti

    Check Collision in advance

    hello! it's my first post here so... i want to say just that my english it too bad so i'll do my best to be clear as possible as i can. i'm a student so i'm trying to understand a lot of stuff, in this case i have to check in advance if my gameobject will fall off the ground after a certain distance, for example i'll attach here a screenshot to be more clear, asl you can se if my gameobject is continue moving forward will fall of the ground, what i want to do is check in advance it then change some stuff to avoid it. someone know how to do it and can help me? thank's you in advance
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!