Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

TeeSea

Members
  • Posts

    2
  • Joined

  • Last visited

TeeSea's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Okay, so I'm going to start working on this in pseudo-code form so I can get around it in my head. Just for clarification I'm aiming for classic 2D sonic mechanics (Ie' those in sonic 1 and 2) Gmod Wire Ranger: Fires a 'laser' from V1 to V2, reports if hits, distance, hisnormal of surface it hits. I'm unsure about what I'll be using about using for ground detection, I'm thinking several rangers in 8, 10 or whatever directions around sonic, find out which ranger has the shortest distance and gets its hit normal, then fires another ranger at the hit normal and gets the distance let's for now, assume sonic is a ball of '10' radius. if SonicInAir = 1 {... SmallestDistance = 10 for I=1,10 { Angle = I*36 DirectionVector = vec(sin(Angle),cos(Angle))*10 RD = ranger(SonicPos,SonicPos+DirectionVector if RD:hit & RD:distance =< SmallestDistance { SmallestDistance = RD:distance GroundNormal = RD:hitnormal Hit = 1 } } if Hit{ RD = ranger(SonicPos,SonicPos+GroundNormal*-10) GroundAngle = RD:hitNormal:toAngle (assuming 90 is flat left ground) SonicXVel = abs(sin(Angle))*SonicXVel SonicYVel = abs(cos(Angle))*SonicYVel Well, what I'm struggling with in my head is how Sonics velocities transition between angles and states and how gravity plays into it, am I to understand the only four states that sonic has are Sonic in air, Sonic 'Rolling' in air (ie; after a jump), sonic rolling on ground (Less friction), Sonic on ground regularly. I tried looking at the MMF code however I find the whole grid-programing thing very unintuitive and hard to read, especially with all the MMF-specific stuff like 'fast loops' (Which I guess translate to for/while loops)? I'm more looking for a generic explanation of sonic physics and how his velocities transition between states.
  2. The vast majority of tutorials and such on this forum are for MMF, Gamesfactory or Gamemaker, which isn't particularly useful for those of us who have no experience with those programs. I'm currently working on developing sonic-esque movement (2D to start off with but will be looking into 3D later on) and I'd like to know if there are any knows of any resources or is will to type up a description themselves in pseudo-code about how the physics of sonic work. The kind of 'collision detect' I have access to in Gmod are points (vectors) which I can check if they're in an object or not and rangers which are lines drawn from Vector A to Vector B and can return their length (If they hit something), whether they hit something and the hitnormal of the surface which they hit. (The Hit Normal is a normalised vector which points directly perpendicular to the surface) I consider myself pretty good with Trig and vectors (Currently doing an astrophysics degree) What I'd like to know is what 'states' does sonic have in which different rules and physics effect sonic, what the rules and physics are of each state and how they transition from state to state, as well as a rough guideline for how sonic can interact with obstacles and good methods of collision detection. Pseudo-code will be very appreciated. Thank you and good day.
×
×
  • Create New...