Jump to content
  • Advertisement

SimLeek

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

109 Neutral

About SimLeek

  • Rank
    Newbie
  1. SimLeek

    Spinning prize wheel

    Well, first off, you can't vary time, acceleration, and final position at the same time. They're dependant on eachother. However, you can vary final position and time, or acceleration and time. (Note: acceleration is always constant for objects that aren't being pushed, so it might be best to just select final position and let the wheel go for as long as it wants.)   Edit: whoops, looks like I assumed things. That wasn't exactly what you were doing.         Well, the equation is correct, but it never included v_final, so the velocity at the end could be non-zero and the wheel could continue spinning.         Whoops, you're right. Still, I think it's overcomplicating things to use Verlet integration when you can just use algebra to get the positions directly. This would be more useful if you had velocity being changed by many different things or controlled by the player, and you wanted it to stay accurate with writing code for all the different cases. Since you're only finding the velocity and position of a wheel that's only spun once, you only need to calculate it directly.   If you were making something that calculated velocity and position in general from acceleration, then that would be perfect. It's also good if you want to be let the player grab the wheel and add some velocity to it.         Ah, yeah. Your first equation takes a kinematic equation, sets vf=0, and then solves for a; Your second one sets time, but not vf.   If you wanted different spining_times and resulting accelerations for the wheel, you could use vf = vi +a*t and set a=-vi / t. Or, you can use spin_degrees=((vi+vf)/2) * t and set t= 2*spin_degrees/vi. You can't set both a and t though.
  2. SimLeek

    Spinning prize wheel

      Why are you trying to find the acceleration based on time? (Really, I have no idea what you're trying to do with that.)   Also, your position calculation is still innacurate and will build up error over time. The only variable you should be basing your time variant variables on is time.       Edit: did you change spinTo to reflect that it was time variant? Or do you want acceleration to change throughout the equation to make the wheel harder to follow?
  3. SimLeek

    Spinning prize wheel

    I'm using v0^2 / ( 2 * s ) to determine the correct deceleration and the spinTo amount is also correct. What is it about my code that is causing incosistencies in the spin stop location?     I didn't look too closely at the equations, but you're basing your next degree off of your modified velocity value, which changes during any amount of time at all. Like I said, if you wanted a predetermined end location, then you should base the position, or degree, off of an equation with the only variable being time. Thats where the xf=xi + vi * t + 0.5*a*t2 equation came in.
  4. SimLeek

    Spinning prize wheel

    The kinqmatic equations for this problem are xf=xi + vi * t + 0.5*a*t2 and vf = vi +a*t   You know v_f=0, you know v_i is whatever you want it to be, you know x_f, you know x_i, and you can set t to whatever you want.   You can then get the correct acceleration algebraically: a=(xf-xi-vi*t)/(0.5*t2)   Then, you can get the velocity whenevery you want by pluggin in the current time value and acceleration to: vf = vi +a*t   You can also get the current position by plugging in the current time and velocity to: xf=xi + vi * t + 0.5*a*t2 (It's a bad idea to go off of your modified velocity, because you can't predetermine it.)       Alternatively, if you want acceleration and deceleration, you can use the modified kinematic equations involving jerk, snap, etc, or you can use the equations for bezier curves, but that's harder. Or you could take the easy way and just have it accelerate for a few revolutions and then slow down.
  5. Hello!   So, I came here because I hit a bit of a speedbump in development. I've been trying to develop a 2.5D game where the visual part is 2D isometric, but the player can jump from platform to platform and scale stairs in a building. I was able to get the layers to change decently when interacting with a building...   (Test Sprite)   ...but strapping on a z-dimension to Box-2D made things a bit too glitchy. I'm sure I could do it well given enough time, but I don't want to reinvent a 3D physics engine. Also, that demo there required me to create huge collision maps for every level of the buildings and every object. (I couldn't use Tiled's tile collisions because they were 2D. )   What I was planning on doing instead was creating 3D collision meshes for the tiles, then using blender+python to copy and paste those collision meshes into one large mesh, join the objects and duplicated vertices, and then perform the 'limited dissolve' operation. Then I would export the resulting mesh.   (Thanks, http://blender.stackexchange.com/a/7498)   But before I write that script and add Bullet to my game, are there any other implementations of these types of 2.5D collisions I should look into? Am I overcomplicating things or doing anything that would cause the game to run slowly?   I mean, I could use the player's position and just look for any collidable objects within a certain distance from the player, but I feel like it'll still be much faster if I combine the collission meshes and use Bullet.       Also, is there a better way to predetermine which tiles should disappear when the character walks into a building? And is there a good way to detect an enclosed space like a building? I suppose I could use ray tracing on the collision mesh from the camera to the center of every tile that can be walked on, but only removing those tiles from the view would create a very small hole to view the character from, and it would also remove items that can be walked behind. I suppose I could add exceptions for objects that are classified as items or less than two or three blocks high, but then things get complicated, especially if I want to make a rocky, cave-like enviornment where there may be somewhat tall pillars. I also don't want to remove anything from surrounding buildings, like what happens now.   (Yay! Ray tracing! http://what-when-how.com/advanced-methods-in-computer-graphics/collision-detection-advanced-methods-in-computer-graphics-part-6/)
  • 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!