Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

180 Neutral

About Neoshaman

  • Rank
    Advanced Member

Personal Information

  • Interests
  1. I'm struggling to find the correct way to make ray intersection with curve that are swept along an axis.In theory I thought it should be simple, I decompose the problem into component:- find intersection on the curve (cross section), which is easy- extrude that intersection point into an axis aligned line, solve the slope intersection to that line to get the final offset.To be sure I got it right, I'm starting with a swept 45° line centered on origin (line-plane intersection with dot product would be more efficient, but remember I'm trying to validating swiping a long a line).- line equation is origine + directionVector * t- line to line intersection equation is t = (origine1 - origine2)/(directionVector2 - directionVector1) >> assuming they are never parallel.So let line2dIntersection(directionVector1,origine1,directionVector2,origine2)Assuming the ray start on the xy plane (pseudo code):- I first compute the cross section into xzintersection1 = line2dIntersection(rayDir.xz, vector2(origine.x,0), vector2(1,1).normalize(), vector2(0,0));result.xz = raydir.xz * intersection1;-Then find the slope swipe offset into yzintersection2 = line2dIntersection(rayDir.yz, vector2(origine.y,0), vector2(1,0).normalize(), vector2(0,result.z));result.y = raydir.y * intersection2;But all my result are garbage. What am I doing wrong? where is the leap of logic I did?
  2.   This walk you through all the theory very succinctly so you get up to date.
  3. Neoshaman

    Space for Unity refugees?

    They are rolling back, current data will be lost.     "UPDATE: We are planning to rollback to the old forum -- more details will come on Monday. In order to rollback as soon as possible, the old forum may be reinstated without the past week's data, so please do save any recent content of importance in the meantime. We're sorry for any and all inconvenience this will cause. Thanks for being patient with us."   edit:   I have no idea how to embed or quote in this forum
  4. Neoshaman

    Collision for tangential movement in unity I would advise any serious person to make complex game with unity ... it does not handle gameplay collision properly
  5. I wonder what you guy would do for a cheap replacement of character controller in unity. I'm trying to make a game with megadrive's sonic pinball physics, think (technically) about mario galaxy meet tony hawk with sonic's high speed. Currently I use a simple raytracing, but I'm looking to listen collision around the sphere collider. In my case i tried: Rigidbody turn the game in a slide show, Intel atom n455 for the win (actually I like the limitation so it can run on most machine). Kinetic body don't collide with scenery (don't listen collision). Character controller don't rotate. Sweeptest() and SweepTestAll() but walls and inward curve fails dramatically. + it does not work with the flash preview of unity 3.x I want to be able to move the character according to tangent of arbitrary complex volumes. For example, taking slope change higher than 90° and leave the case handling with special case code (for example stopping at a wall or falling down a cliff) Currently my code is this one, with sweeptest():   private void UpdateSurfacePosition() { Ray//origine, direction ground_check_ray = new Ray( gameObject.transform.position, -gameObject.transform.up);// * (Momentum.magnitude + 1)); RaycastHit raycast_result; Rigidbody rigid_body = gameObject.rigidbody; rigid_body.detectCollisions = false; rigid_body.isKinematic = true; bool onGround;// = //Physics.Raycast( ground_check_ray, out raycast_result );//ray, hit //rigid_body.SweepTest(-gameObject.transform.up, out raycast_result);//direction, hit, distance raycast_result = new RaycastHit(); RaycastHit[] contacts = rigid_body.SweepTestAll(-gameObject.transform.up); rigid_body.SweepTest(-gameObject.transform.up, out raycast_result); if (contacts.Length > 0) { onGround = true; int i=0; while (i != contacts.Length) { raycast_result.normal += contacts[i].normal; i++; } raycast_result.normal = raycast_result.normal.normalized; } else { onGround = false; } debug1 = "Normal > " + raycast_result.normal.ToString() + " Position > "+ raycast_result.point.ToString() //+" transform > "+ + " Contact > " + contacts.Length ; if ( onGround ) { Vector3 next_position; //UpdateOrientation( gameObject.transform.forward, raycast_result.normal ); UpdateMoveOrientation( gameObject.transform.forward, raycast_result.normal ); next_position = GetNextPosition( raycast_result.point ); rigid_body.MovePosition( next_position ); //ground_direction = raycast_result.normal; } else//onAir { //if forward close to dot.Y = abs(1) choose -up if 1 and up if -1 UpdateMoveOrientation( gameObject.transform.forward, raycast_result.normal ); } }  
  7. I have made some package for those who want to tweak the code (unity3D 3.x) Zipped project Unitypackage
  8. Hello!   I have been working on a game for quite long, think sonic classic physics in 3D or tony hawk psx, with unity3D. However I'm stuck at the most fundamental aspect of movement.   The requirement is that I need to move the character in mario 64 fashion (or sonic adventure) aka relative cam input: 1. the camera's forward direction always point input forward the screen, left or right input point toward left or right of the screen. 2. when input are resting, the camera direction is independent from the character direction and the camera can orbit the character 3. when input are pressed the character rotate itself until his direction align with the direction the input is pointing at.   It's super easy to do as long your movement are parallel to the global horizontal (or any world axis). However when you try to do this on arbitrary surface (think moving along complex curved surface) with the character sticking to the surface normal (basically moving on wall and ceiling freely), it seems harder. What I want is to achieve the same finesse of movement than in mario but on arbitrary angled surfaces. There is more problem (jumping and transitioning back to the real world alignment and then back on a surface while keeping momentum) but so far I didn't even take off the basics.   So far I have accomplish moving along the curved surface and the relative cam input, but for some reason direction fail all the time (point number 3, the character align slowly to the input direction).   Do you have an idea how to achieve that?   Here is the code and some demo so far:   the camera code using UnityEngine; using System.Collections; public class CameraDrive : MonoBehaviour {     public GameObject         targetObject;          public Transform         camPivot,         camTarget,         camRoot,                  relcamdirDebug;              float         rot = 0; //----------------------------------------------------------------------------------------------------------     void Start()     {         this.transform.position = targetObject.transform.position;         this.transform.rotation = targetObject.transform.rotation;     }          void FixedUpdate()     {             //the pivot system         camRoot.position    = targetObject.transform.position;              //input on pivot orientation         rot = 0;         float mouse_x        = Input.GetAxisRaw( "camera_analog_X" );                //         rot                 = rot + ( 0.1f * Time.deltaTime * mouse_x );            //         wrapAngle( rot );                                                            //              //when the target object rotate, it rotate too, this should not happen                          UpdateOrientation(this.transform.forward,targetObject.transform.up);         camRoot.transform.RotateAround(camRoot.transform.up,rot);              //debug the relcam dir             RelativeCamDirection()             ;              //this camera         this.transform.position    = camPivot.position;                            //set the camera to the pivot         this.transform.LookAt( camTarget.position );                            //     } //----------------------------------------------------------------------------------------------------------     public float wrapAngle ( float Degree )     {         while (Degree < 0.0f)         {             Degree = Degree + 360.0f;         }         while (Degree >= 360.0f)         {             Degree = Degree - 360.0f;         }         return Degree;     }          private void UpdateOrientation( Vector3 forward_vector, Vector3 ground_normal )     {         Vector3             projected_forward_to_normal_surface = forward_vector - ( Vector3.Dot( forward_vector, ground_normal ) ) * ground_normal;                  camRoot.transform.rotation = Quaternion.LookRotation( projected_forward_to_normal_surface, ground_normal );     }          float GetOffsetAngle( float targetAngle, float DestAngle )     {             return ((targetAngle - DestAngle + 180)% 360)  - 180;     } //----------------------------------------------------------------------------------------------------------     void OnDrawGizmos()     {         Gizmos.DrawCube(             camPivot.transform.position,         new Vector3(1,1,1)             );                  Gizmos.DrawCube(             camTarget.transform.position,         new Vector3(1,5,1)             );                  Gizmos.DrawCube(             camRoot.transform.position,         new Vector3(1,1,1)             );     }          void OnGUI()     {         GUI.Label(new Rect(0,80,1000,20*10), "targetObject.transform.up : " + targetObject.transform.up.ToString());         GUI.Label(new Rect(0,100,1000,20*10), "target euler : " + targetObject.transform.eulerAngles.y.ToString());         GUI.Label(new Rect(0,100,1000,20*10), "rot : " + rot.ToString());     } //----------------------------------------------------------------------------------------------------------     void RelativeCamDirection()     {                          float             input_vertical_movement     = Input.GetAxisRaw( "Vertical" ),             input_horizontal_movement     = Input.GetAxisRaw( "Horizontal" );                  Vector3             relative_forward     = Vector3.forward,             relative_right         = Vector3.right,                          relative_direction    =                 ( relative_forward    * input_vertical_movement )                 +                 ( relative_right    * input_horizontal_movement )                 ;                  MovementController MC = targetObject.GetComponent<MovementController>();                  MC.motion = relative_direction.normalized * MC.acceleration * Time.fixedDeltaTime;                  MC.motion = this.transform.TransformDirection( MC.motion );                  //MC.transform.Rotate(Vector3.up, input_horizontal_movement * 10f * Time.fixedDeltaTime);         } }     The movement code   using UnityEngine; using System.Collections; public class MovementController : MonoBehaviour {     public float         deadZoneValue = 0.1f,         angle,         acceleration  = 50.0f;     public Vector3         motion ; //--------------------------------------------------------------------------------------------         void OnGUI()     {         GUILayout.Label( "transform.rotation : " + transform.rotation );         GUILayout.Label( "transform.position : " + transform.position );         GUILayout.Label( "angle : " + angle );     }          void FixedUpdate ()     {                  Ray             ground_check_ray = new Ray( gameObject.transform.position, -gameObject.transform.up );         RaycastHit             raycast_result;         Rigidbody             rigid_body = gameObject.rigidbody;                  if ( Physics.Raycast( ground_check_ray, out raycast_result ) )         {             Vector3                 next_position;                          //UpdateOrientation( gameObject.transform.forward, raycast_result.normal );             UpdateOrientation( gameObject.transform.forward, raycast_result.normal );                 next_position = GetNextPosition( raycast_result.point );             rigid_body.MovePosition( next_position );         }     } //--------------------------------------------------------------------------------------------                   private void UpdateOrientation( Vector3 forward_vector, Vector3 ground_normal )     {         Vector3             projected_forward_to_normal_surface = forward_vector - ( Vector3.Dot( forward_vector, ground_normal ) ) * ground_normal;                  transform.rotation = Quaternion.LookRotation( projected_forward_to_normal_surface, ground_normal );     }          private Vector3 GetNextPosition( Vector3 current_ground_position )     {         Vector3             next_position; //        //-------------------------------------------------------------------- //        angle = 0; //        Vector3 dir = this.transform.InverseTransformDirection(motion); //        angle = Vector3.Angle(Vector3.forward, dir);// * 1f * Time.fixedDeltaTime; //         //        if(angle > 0) this.transform.Rotate(0,angle,0); //        //--------------------------------------------------------------------                           next_position =             current_ground_position +             gameObject.transform.up * 0.5f                 + motion                 ;                  return next_position;     }      }   Demo:
  9. Neoshaman

    Binary DM - final take

    Hello! Sorry for the long time However, i'm trying to open a solid door to handle some kind of story with enough degree dynamic stories. I also serve as a bridge between story and game-play mechanics with an unified model. But it only model a goal like structure (which is the aesthetics of most interactive fiction). But even if it fails to provide that for some people, it is still a solid framework to use. And i'm planning to explain it by breaking things a bit more, it's just the huge amount of work in the later days that have slowed me down. I'm also non native English speaker, i think there may be terms that are not well chosen. Thank you for the attention :)
  10. Neoshaman

    Binary DM - final take

    It's been six year, in this thread i had started thinking about how to make a binary dm, following path set by member like Sunandshadow, Bishop_pass, Kordova and Oluseyi. After some extensive research and try, i think i'm close to that dream and i want to share it with you. Here the first part of the DNA of game and story: There is a lot to explain, but basically this is the structure and function that create the experience of a story in a goal structure. I need to explain the details and nuance of the different functions. The model is highly relative, to use it you need to take a point of view, it's also scalable and fractal, it can explain a single action to whole overall story movement from the same work. There is a concept of "space", the story can exist simultaneously in physics, psychologic, social and morals space at the same time, and those space communicate by sharing function between them. Other part of the model is a dynamic chart that plot emotion movement and how they relate to this one. And there is also a methodologies to handle dynamics in a plot and made it practical for implementation.
  11. Neoshaman

    edge grabbing in 3D platformer

    I have already check splinter cell pandora tomorow, and lately mario64 et tomb raider Tomb raider level editor tutorial: Does not seem to feature edge tagging but the level are structured and edited in a rigid ways with grid, so it must happen in compilation time or in realtime since the level geometry is "readable". Interestingly looking at this video we can se that it cover more case i previously thought (grab after a slope with a vertical wall) Mario 64 level hack editor: I have browse the tools and the forum to see if there is some hint, it seems that the only things which is important is the collision mesh, no tagging per see I wonder how many game that feature grabing have a level editor, so we can find hint from editing ?
  12. Neoshaman

    edge grabbing in 3D platformer

    Hello David thanks for your input, it's great to see that people already had that experience! Tell me more about the raycast? I'm not sure i visualize that in details, you cast ray AFTER having collided the edge for grabbing? Thinking a little more, i guess you first process all edge for proximity (i have yet to figure how to do this since they are not point and can span some length), then find the edge that face the character's hand and at the end process the closest point of the line? But i'm a designer and not much a real programmer. Quote:Is there any reason you wouldn't want designers/artist to tag which geometry is an edge grab? However having worked on AAA like canned game, having make a pandora tomorow mod, and having done some research before, i'm well aware than most studio use tagging as a mean to navigation in the game world. I have to admit that my original post is somewhat vague about that and my claim about mario must be overdone (however my experience with the game and most N64 era nintendo game shows any king of weird case that hint a no tagging but collision mesh based navigation). The reason i choose to investigate a more systemic approach is because i don't have a studio to tag level, it has a cost. For a Game studio hiring people to do that is most cost effective in term of time, quality and money. Also most triple AAA game have a great part which involve with linear and script scenography, having the player go anywhere any time is a big no no to not break the intended flow. Automated process in such situation is a mean to save time and does not necessary seek the state of the art since R&D bring some risk and cost money and time. Investigating this solution is really an exercise to investigate the problem and is short coming and eventually finding solution to these shortcoming toward a more robust solution. The game I plan is a pure and simple plateformer without any sense of scripted encounter, that mean that sequence breaking is part of the game as a gameplay, for which the focus is exploration. This design choice that fit the constrain of automation and let me explore the case. The other solution is to put constrain on level editing regarding respect of metrics... But artist... Yes most game artist, coming from a fine art (instead of graphic design and information design), want "chaos". We always have the fight against them as designer are all about grid align and metrics, but this is a designer control project ;) EDIT: short answer, the player should thrust and read the world not the designer's idea :) [Edited by - Neoshaman on January 20, 2009 4:47:00 AM]
  13. Neoshaman

    edge grabbing in 3D platformer

    i have done this little study to see case for a tagging at level compilation time. <br/> But we must assume close mesh, with self intersection , and without fan... An interesting edgy problem is the fan, the double sided and "folded" triangle
  14. Neoshaman

    edge grabbing in 3D platformer

    Thanks for the input! I have plan some study about the edges really like yours Oliii, fortunately illustrator crashed i cannot post them now... This is amazing that there is so little documentation about this and how crazy my first attempt was :)
  15. Neoshaman

    edge grabbing in 3D platformer

    Oh great! I did think about discriminatng the triangle from the normal, cool idea Also i was already thinking about extreme case, for exemple what if the systeme snap a "crack" in a model, i mean if two edge are too close and would get the model stuck in a imposiible place? OF course this is a problem that could be allievate by using correct metric in level design, but just in case of it's a good thing to prevent these things. Also it's easy to discrimate edge that are too small on grab or too close but still need to consider them (for exemple if we could move along the edge). Thanks for that input but now i must discover how to do a line to sphere collision...
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!