Jump to content

  • Log In with Google      Sign In   
  • Create Account


thecoast47

Member Since 03 Dec 2010
Offline Last Active Jul 13 2013 11:40 PM
-----

#4949362 Numerical integration methods

Posted by thecoast47 on 14 June 2012 - 06:07 PM

Apparently this is verlet integration:
[source lang="cpp"]void Particle::integrate(float timestep){ Vec2 Temp = P.Position; P.Position += P.Position - P.OldPosition + P.Acceleration*Timestep*Timestep; P.OldPosition = Temp;}[/source]
I got it from this article,


#4824860 I give up.. Generating indices for a cylinder?

Posted by thecoast47 on 18 June 2011 - 01:09 PM

I have a theory ....
here is code for a circle in 2D...
If i were you i would probably try using this to to place points around the Z axis and then increment Y Axis .
If you do this a couple times and then somehow connect the vertices the right way... then you should get a cylinder.

void RenderCircle(){
            float numSubdivisions = 24;
            glBegin(GL_TRIANGLE_FAN);
                glColor4f(R, G, B,0);
                glVertex3d(CENTER.X,CENTER.Y,Depth);

                // Set edge colour for rest of shape
                glColor4f(0, 0, 0,0);
                for (float angle=0; angle<=PI*2; angle+=((PI*2)/numSubdivisions) )
                {
                  glVertex3d( radius*(float)cos(angle) + CENTER.X,
                              radius*(float)sin(angle) + CENTER.Y,
                              Depth);
                }

                glVertex3d(CENTER.X+radius,CENTER.Y,Depth);
            glEnd();
}



Or if you want to brute force it... you can just connect the subdivisions together by drawing lines....If you draw enough 3D circles translated on the Y axis enough times then you also get a cylinder...


#4803554 Where do I start?

Posted by thecoast47 on 27 April 2011 - 08:27 AM

Here are the languages i started with:
-visual basic 3
-visual basic 6
-JavaScript
-java (with openGL)
-c++(with SDL/OPENGL) <--industry standard
Also you need to learn:
MATH:
linear algebra
vectors
Matrix math
trigonometry
trig identities
Programming CONCEPTS:
sorting algorithms
Multi threading
Object orientation
dynamic memory
blitting
buffers
I recommend learning java then c++.
Or if you want to start with c++,just buy a book on C++ and another on SDL


#4767220 The Specifics of a good Platformer's Physics

Posted by thecoast47 on 30 January 2011 - 05:45 PM

I've done Line segment collision recently.
My collision footage is here: http://www.youtube.c...h?v=ARYgb-_kQqI

All you you have to do is find the slope of the X and Y velocities of your shape and the wrap and invisible line along the tiles that have a slope. That way you can find the point of intersection and check if the player is close or equal to the point of intersection.

I use slope intercept for the equation of the line but you could also use the other form( know its something Like Ax +By +C = 0).
Let the position of the player be (30,60)
Players Line Equation(Y = Mx+B)
So slope of the player = M
M = Yvel/Xvel
Now we need to find B so all we need to do now is plug in any point that belongs to the slope into the equation.
So 60 = M(30) + B therefore B = Y - (M(X))
SO you have the Y intersection
And now you need X;
Basically Repeat these steps for the invisible Line and then Substitute the Y of the player's line equation into the Equation of the invisible line
SO your going to get Mx + b = Mx + B
and Solve For X
and there you go you have a point of intersection to check collision!
Hope this helped
k.


PARTNERS