How to get velocity and vector of movable body in AndEngine? - android

I have a little problem. I am trying to make air hockey android game (something like glow hockey). And durning my adventure with first steps of getting know AndEngine, I've found a following problem:
In air hockey as you may know, player's disc can be moveable by touching it.
Problem is, that I need to get velocity and vector of player's moves. Why? I want to make perfect physics when player's body collides with hockey's disc(jumps to vector with proper player's velocity). I mean when player moves slowly- hockey's disk, after collision with bodies, will obtain low velocity but vector won't change. etc. Maybe you can tell me better solution of my problem? Are there any AndEngine solutions for this?
Thank you a lot!

There are two ways of solving this. First would be through the AndEngine Box2D extension. You could apply circular "bodies" to the pucks and the disk, and play around with physics elements like the mass and friction till you are happy with your result.
Forum: http://www.andengine.org/forums/physics-box2d-extension/
The other option is to do it manually, which I would only do so if you want a challenge. Personally I would avoid this as there is a lot of maths involved which Box2D will do for you :)

Related

Unity VR How to focus eyes correctly

I am making an Android app for Unity, using my own VR engine. It is small, and I have got looking around working perfectly. The only problem I am experiencing is where I cannot get my eyes to focus on the objects in front of them. I get double vision where my left eye sees objects too far to the left, and right eye to the right. I have tried pointing the eye cameras slightly inwards and moving them based on a raycast to find out where they are looking.
I am guessing it could be something to do with pointing the eyes outwards, my rig - nintendo labo headset with android phone inside [ making do with what I've got ;) ] - unfortunately the phone and lenses don't quite line up but this doesn't seem to affect one of my other projects, or perhaps I need to distort my camera in a special way.
Honestly, I have no idea! Some help from an expert or anyone who is slightly clued up in the subject would be greatly appreciated :D
It turns out I literally just need to point the cameras out rather than in

How to do 2D animation in Unity

So I'm doing a 3D game for kids for Android and iOS in Unity, but i'm new in game developing and it's been really difficult to plan the assets.
We need to create 2D animations (paper like characters) and the characters have to be really detailed with great animations.
We have been thinking of several options:
We could create frame by frame animations but our designer says there has to be at least 24 images per second (because of 24 fps per second) with this the app will be very big.
Other option is to create 2D models in Blender and animate them there, but it's a lot of work and could take a lot of time.
The last option is to have the pieces of the model an animate it throughout code but it's a lot of work and I believe the quality of the animations would be low.
What's the better way to create 2D animations in Unity?.
Thank you!
Have you explored the 2D sprite engines that are available in Unity? Whoever said "Unity isn't really an engine designed to work with 2D stuff" is talking guff. I have just started working on a hobby 2D game and am using a Unity plugin called Orthello (see WyrmTale website for info). It handles sprite sheets, animations, collision detection and more without you having to write loads of code to do this. The learning curve is a bit steep and the examples on their website aren't the best but I found replicating the sample solutions that come with the download the best way to get something working.
There's also a similar tool called Sprite Manager 2 but you have to pay for that (I think). Check out the asset store for more information.
I would be really interested to hear if Orthello is what you're looking for and how you find working with it - please let me know via http://markp3rry.wordpress.com if you can.
Just because the app runs at 24fps doesn't mean you can't just display the animations for more than one frame of the main loop. It might not be smooth, but then again looking at the sprite sheets of games like super street fighter it doesn't look like they're at anywhere close to 24fps (the sprite sheet for Dhalism in SF3 Alpha is a 210kb .gif file on my computer, and there's less than 252 frames of animation on it. Likewise, the total storage space take up by every character sprite in Dustforce takes up a mere 7mb, though those sprites are just 192x192, maybe too low-res for you. They do look like paper though). I doubt that anything involving blender would take longer than hand animating -- Blender does key frames for you.

AndEngine VS Android's Canvas VS OpenGLES - For rendering a 2D indoor vector map

This is a big issue for me I'm trying to figure out for a long time already.
I'm working on an application that should include a 2D vector indoor map in it.
The map will be drawn out from an .svg file that will specify all the data of the lines, curved lines (path) and rectangles that should be drawn.
My main requirement from the map are
Support touch events to detect where exactly the finger is touching.
Great image quality especially when considering the drawings of curved and diagonal lines (anti-aliasing)
Optional but very nice to have - Built in ability to zoom, pan and rotate.
So far I tried AndEngine and Android's canvas.
With AndEngine I had troubles with implementing anti-aliasing for rendering smooth diagonal lines or drawing curved lines, and as far as I understand, this is not an easy thing to implement in AndEngine.
Though I have to mention that AndEngine's ability to zoom in and pan with the camera instead of modifying the objects on the screen was really nice to have.
I also had some little experience with the built in Android's Canvas, mainly with viewing simple bitmaps, but I'm not sure if it supports all of these things, and especially if it would provide smooth results.
Last but no least, there's the option of just plain OpenGLES 1 or 2, that as far as I understand, with enough work should be able to support all the features I require. However it seems like something that would be hard to implement. And I've never programmed in OpenGL or anything like it, but I'm willing very much to learn.
To sum it all up, I need a platform that would provide me with the ability to do the 3 things I mentioned before, but also very important - To allow me to implement this feature as fast as possible.
Any kind of answer or suggestion would be very much welcomed as I'm very eager to solve this problem!
Thanks!

How to implement physical effect, perspective effect on Android

I'm researching about 2D game for Android to implement an Android Game Project. My project looks nearly like PaperToss. Instance of throwing a page, my game will throw a coin. Suppose that I have a coin put in three-dimensional that have coordinates at A(x,y,z). I throw that point ahead, after 1/100 second, that coin move from A(x,y,z) to A'(x',y',z'). By this way, I have two problems need to solve.
Determine the formulas can be used to compute the coordinates of the coin at time t.
This problem is under-researching. I have no idea to solve this problem.
Mapping three-dimensional points to a two-dimensional and use those new coordinates (a two-dimensional coordinates) to draw our coin on screen. I have found two solutions for this problem: Orthographic projection & Perspective projection
However, my old friend said that OpenGL supports to solve problems like my problems. Any body have experiences about my problems?
Help me please :)
Thank for reading my question.
My personal opinion is to use a 3D engine since I don't like doing hacky stuff trying to fake 3D with 2D. However, 2D is much more beginner friendly, so if you're not planning to do anything fancy like actually emulating how coin actually rotates in air then I think it's doable in 2D.
My approach to do this would be to use a framework like libgdx instead of dealing with OpenGL ES directly. They have built in support for view projection (PerspectiveCamera), high level 2D/3D rendering support and even a wrapper for OpenGL ES if you really want to go low level. I'm not so sure about how you would approach the physics part right now.
Good luck....

Touching an object in a tweened animation?

I'm having trouble porting a simple game I developed for the iPhone
over to Android. The game has an animated ball which moves from Point
A to Point B. The user must touch the ball before it reaches point B
or lose the game. This was easy to implement on the iPhone using Core
Animation since I could locate the current position of the ball by
accessing its animation layer. In Android, I attempted to recreate the
game using tweened animation and represented the ball as a Drawable.
My issue is that I can't determine if the user is touching the spot
because the Drawable apparently bounds do not update as the ball
visually moves - making the program think the ball is always in its
original position. While searching these forums I saw an Android team
dev. confirm that you can't get the current location in a tweened
animation but offered no solution for a workaround. Can I accomplish
this on the Android using my current approach? If not, what approach
should I use?
Best regards,
Michael
Can I accomplish this on the Android
using my current approach?
I doubt it. Android's tweened animations are not really designed for games.
If not, what approach should I use?
Implement the game using 2D drawing on the Canvas -- see the LunarLander sample in your SDK.

Categories

Resources