# ElganSayer

Members

3

101 Neutral

• Rank
Newbie
1. ## 2D Parabolic Arc between dynamic A-B

Hello, I have a problem and I'm not smart enough to work out a solutions. I want to achieve a throw, a bomb between two points, and so it travels as an arc from point A, to point B. [b]Point B is known and the bomb must land on point B[/b] if the distance between the two positions AB is dynamic and the horizontal distance changes, the vertical distance may also change. How can we know the initial vertical velocity in which to throw the object to make it art exactly on to position B? How can I calculate it so my bomb moves in an arc from whatever point A is, so that it hits point B in an ARC. I have no idea, using other istes this is what I tried, i tried at least...then realized I have no idea for how long to run the loop for, and have no idea how to hit point b exactly. tagetTilePosition is a vector ( 0 , 0 ) [code] double startX = bombPosition.x; // initial position double startY = bombPosition.y; // of the object float angle = 45.0f * Mathf.Deg2Rad; const double g = 9.8; // gravity (meters/s^2) double velocity =20.0; double Vx = velocity * Mathf.Cos(angle); // x (horizontal) component of velocity double Vy = velocity * Mathf.Sin(angle); // y (vertical) component of velocity Vector2 distance = ( bombPosition2 - tagetTilePosition ); //guessing double endTime = ( distance.x + distance.y ) / velocity ; for(double wait = 1; wait <= endTime ; wait += 1f) { /* float v_v; double g = 9.8f float s; float t = wait; s = bombPosition.y; t = d / v_h v_v = (0.5f * g * (t * t) + s) / t; */ double t = wait; double x = startX + Vx * t; double y = startY + Vy * t - 0.5 * g * t * t; bombPosition.x = (float) x; bombPosition.y = (float) y; // bombPosition.x = centre.x += ( 60 * Mathf.Cos ( (float) wait ) ); //bombPosition.y = centre.y -= ( 60 * Mathf.Sin ( (float) wait) ); bomb.transform.position = bombPosition; } [/code]
2. ## ElganSayer

"Elgan, Have you ever been in love?" "I will know when I'm in love. When I start using condoms with the other girls"

nighttt
4. ## ElganSayer

making a mountain out of a mole hill

Bombathon
6. ## ElganSayer

would you like a wormdo?
7. ## ElganSayer

Scavenger Hunt?
8. ## ElganSayer

irs that time of year. again when facevook is not worth checking...
9. ## OpenGL ARGB to RGBA

Thanx Very interesting! I just want to get back from being here over christmas to my office at home! grr Further information: THe buffer is coming from here: [url="http://berkelium.org/class_berkelium_1_1_window_delegate.html#a0eb2f81283232cc6050ac652a872cf8f"]Berkelium[/url] [code]virtual void Berkelium::WindowDelegate::onPaint ( [url="http://berkelium.org/class_berkelium_1_1_window.html"]Window[/url] * [i]win[/i], const unsigned char * [i]sourceBuffer[/i], const [url="http://berkelium.org/struct_berkelium_1_1_rect.html"]Rect[/url] & [i]sourceBufferRect[/i], size_t [i]numCopyRects[/i], const [url="http://berkelium.org/struct_berkelium_1_1_rect.html"]Rect[/url] * [i]copyRects[/i], int [i]dx[/i], int [i]dy[/i], const [url="http://berkelium.org/struct_berkelium_1_1_rect.html"]Rect[/url] & [i]scrollRect[/i] ) [inline, virtual] The window is being painted. You need to synchronously copy the buffer into application (video) memory before returning. [b]Parameters:[/b] [i]win[/i] [url="http://berkelium.org/class_berkelium_1_1_window.html"]Window[/url] instance that fired this event. [i]sourceBuffer[/i] ARGB buffer with width/height of sourceBufferRect. [i]sourceBufferRect[/i] [url="http://berkelium.org/struct_berkelium_1_1_rect.html"]Rect[/url] containing the buffer. [i]numCopyRects[/i] Length of copyRects. [i]copyRects[/i] Array of valid+changed rectangles of sourceBuffer. Anything not in copyRects is usually garbage data. While these must lie within sourceBufferRect to make sense, they are not relative to sourceBufferRect. [i]dx[/i] If non-zero, the area of the page specified by scrollRect has been scrolled horizontally. [i]dy[/i] If non-zero, the area of the page specified by scrollRect has been scrolled vertically. [i]scrollRect[/i] Area of the page to scroll. Only valid if dx&&dy. [/code] and being applied to [url="http://www.sfml-dev.org/documentation/1.6/classsf_1_1Image.php#a67d65c552c9bcba989a061e9c5b5d10c"]SFML[/url] [code] LoadFromPixels(w, h, PointerToPixelsInMemory); Please note that when you load an image from memory, pixels must have a specific format, which is 32-bits RGBA. [/code]
10. ## OpenGL ARGB to RGBA

Hello I have a buffer in ARGB format. for display in the library im using i need it to be, RGBA bitmap_in = sourceBuffer ARGB buffer with width/height of sourceBufferRect [code] if (!Image.LoadFromPixels(bitmap_rect.width(),bitmap_rect.height(), bitmap_in)) { // Error... } [/code] LoadFromPixels(w, h, PointerToPixelsInMemory); Please note that when you load an image from memory, pixels must have a specific format, which is 32-bits RGBA. I think I can bind them to opengl textures, but im using a library which doesnt give me much power to manipulate that. So to do this, i guess i need to convert the buffer...i have no idea where to start. atm im trying to break it down into single chars, and swap a and put it at the end of every . forth? but im breaking the images and am a bit lost.