I,m using min3d framework on my device to make some car game, so i created some simple car model and simple and its moving, but i want to create ''physics'' and i need the collision detection which isn't provided in min3d (i won't change framework because i have android 2.1 without possibility to upgrade) i want to create it by my self but the problem is that i don,t know how to check if the plane collides with anything what i want to do is:
-create simple flat rectangle (not cube) and i want to place it in front of ''car'' and check if something gets inside of this rectangle and something does i want the car to bounce of it in reversed direction (the problem isn't to bounce but: how to check if something gets through my rectangle)
I have some other problem too:/
When i enclose my ''game''(haha) with a LinearLayout in xml everythong is going fine till i use the command to set the text with the value of rotation of a car for example -then is force close:/ I'm doing it form my class from which i load my objects (i'm providing my classes too)
I was searching for tutorials on the web but none of them was tlaking about 3d collision and even if it was about 3d there was too much code that wasnt need and i was loast in it so i dont get anything
I ask you royal users from stackoverflow to provide me example for creating the rectangle(if needed, because i can laod model from .3ds and .obj)and check if something gets through it(intersects?) not for entire code but just for the method how to do that, and how to refrsh the value of a car, in layout without a crash
By the way: my ''game'' is using qwerty keyboard as input (i,o,p,l keys)
Wanted to post my class here but its to much of lines and was getting erros so grab it on free hosting site, its scanned by avast already on my pc, it contains my entire project with min3d too.
My sources ready to compile and run are(with min3d -which isn't mine):
http://odsiebie.pl/ax1v1p5tam8i/KRL044.7z.html
thanks in advice:)
an approach is to break it down to two dimensions (xy). imagine that your cars are 2D-Rectangles. in the moment you want to check collision, just check if any of the four corners of your "car" is within the rectangle of another car. might be not best practise but works for me.
instead of this you could use r-tree sqlite to check collision.
Related
I'm not even sure that equalizer is the right name for it. Basically i need to show sound wavering, like in screenshot below:
I was looking throw stack, and googling, overall i found this library:
https://github.com/steelkiwi/AndroidRecording
What i've achieved using it is :
As you can see it's just previous result just fading and new one is drawing above it on canvas. This is achieved using android class Visualizer(https://developer.android.com/reference/android/media/audiofx/Visualizer.html)
But what i need is to gather and show both previous and new data by moving canvas like this:
And also i need to store all this data somewhere to then show it all in Play mode, or just something that will show full data of audio while playing(not only part like now)
Summary: In theory i can move canvas and drawig data manually, which i don't want to do, because i'll lose some time on optimizing drawing and making the whole thing. Also, it won't resolve my issue with playing, because data only for current moment will be sent to visualizer. So i need something like library or advice from someone, who worked with the same or similar functionality
If something is unclear, please ask your question in comments
I'd like to display a watch face I've developed in my app and have it appear live as though it was on a watch. The class and engine already exist so i feel like it shouldn't be too hard to get it to appear within an activity. Does anyone have experience with this or have a suggestions as to which path to take in attempting this?
It should be fairly easy to achieve. What you need to do is this:
extract all the drawing logic; which is whatever code is interacting with Canvas.
create a custom View and in View.onDraw(Canvas) use the extracted code to draw the watch face.
In the end everything draws on a Canvas, so you can (more or less) transfer functionality from View objects to WallpapersService. View system is an abstraction on top of Canvas.
im new to this android things. And i have to develop an application that can help an autism to learn numbers. I have a few ideas and I've been trying to learn and implement the code. But it's failed. The question is how can i apply the motion code or sprite to draw a numbers or letter? For example like this, i wanna make the penguin move through the line and draw a number nine.
There is example from mybringback.com which is the image move to draw a rectangle. How can i implement it to draw a number? Im sorry if i asking too much, i just trying to get some ideas.
I think that you should first build an utility program, in order to create the "path vector".
What I mean by path vector is simply a vector of Points (where a point has x value, and y value). And your utility should let you draw whatever you want, with a simple pen. You should draw on surface and store points when mouse is down, and ignore points when mouse is up.
Then, in the main program, you will just have to read at the path of your number/letter.
I've tried to implement something like this for the Sugar OLPC platform, without serializing path into files : I was able to draw, and to view the animation. And I used the process I've just described you.
Hope it can help you.
P.S : I used the word mouse, but you guessed that I talk about finger ...
There are various ways to achieve animation effects. One approach that is quite versatile involves creating a custom View or SurfaceView in which you Override the onDraw method. Various tutorials can be found on this; the official Android discussion of it is here:
http://developer.android.com/guide/topics/graphics/2d-graphics.html#on-view
Your implementation will look something like this:
// Find elapsed time since previous draw
// Compute new position of drawable/bitmap along figure
// Draw bitmap in appropriate location
// Add line to buffer containing segments of curve drawn so far
// Render all segments in curve buffer
// Take some action to call for the rendering of the next frame (this may be done in another thread)
Obviously a simplification. For a very simplistic tutorial, see here:
http://www.techrepublic.com/blog/software-engineer/bouncing-a-ball-on-androids-canvas/1733/
Note that different implementations of this technique will require different levels of involvement by you; for example, if you use a SurfaceView, you are in charge of calling the onDraw method, whereas subclassing the normal View lets you leave Android in charge of redrawing (at the expense of limiting your ability to draw on a different thread). In this respect, Google remains your friend =]
i have been working with object detection / recognition in images captured from an android device camera recently.
the object i am trying to detect are all kinds of buttons that look like this:
Picture of buttons
so far i have been trying with OpenCV and also with the metaio SDK. results:
OpenCV was always detecting something, but gave lots of false hits. also it is too much work to collect all the pictures for what i have in mind. i have tried three ways with OpenCV:
FeatureDetection (SURF, ORB and so on) -> was way too slow and not enough features on my objects.
Template Matching -> seems to only work when the template is exactly a part out of the scene image
Training classifiers -> this worked the best so far, but is too much work for my goal, and still gives too many false detections.
metaioSDK was working ok when i took my reference images (the icon part of each button) out of a picture like shown above, then printed the full image and pointed my android device camera at the printed picture. but when i tried with the real buttons (not a picture of them) then almost nothing got detected anymore. in the metaio documentation it is said that the reference images need to have lots of features and color differences and also should not only consist of white text. well, as you see my reference images are exactly the opposite from what they should be. but thats just how the buttons look ;)
so, my question would be: does any of you have a suggestion about what else i could try to detect and recognize each of those buttons when i point my android camera at them?
As a suggestion can you try the following approach:
Class-Specific Hough Forest for Object Detection
they provide a C code implementation. Compile and run it and see the results, then replace positive and negative training images with the ones you have according the following rules:
In a car you will need to define the following 3 areas:
target region (the image you provided is a good representation of a target region)
nearby working area (this area have information regarding you target relative location) I would recommend: area 3-5 times the target regions, around the target, can be a good working area
everything outside the above can be used as negative images
then,
Use "many" positive images (100-1000) at different viewing angles (-30 - +30 degrees) and various distances.
You will have to make assumptions at which viewing angles and distances your users will use the application. The more strict they are the better performance you will get. A simple "hint" camera overlay can give a good idea to people what you expect the working area to be.
Use few times (3-5) more different negative image set which includes pictures of things that might be in the camera but should not contribute any target position information.
Do not use big images, somewhere around 100-300px in width should be enough
Assemble the database, and modify the configuration file that the code comes with. Run the program, see if performance is OK for your needs.
The program will return a voting map cloud of the object you are looking fore. Add gaussian blur to it, and apply some threshold to it (you will have to make another assumption for this threshold value).
Extracted mask will define the area you are looking for. The size of the masked region can give you good estimate of the object scale. Given this information it will be much easier to select proper template and perform template matching.
(Also some thoughts) You can also try to do a small trick by using goodFeaturesToTrack function with the mask you got, to get a set of locations and compare them with the corresponding locations on a template. Constuct an SSD and solve it for rotation, scale and transition parameters, by mimizing alignment error (but not sure if this approach will work)
I am looking to be pointed in the right direction for help. What I want to do is take a picture, and then be able to highlight certain aspects of it (i.e circle a door, comment on a color) right onto the picture. Basically what a Samsung note can do. What android package would I be looking at? What it looks like to me, is that I would use the picture as a canvas and then draw on top of the canvas(which is the picture), is that it basically summed up? Or am I missing something?
Another thing that I would like to do with the picture is add data for future identification. I know android has their Exif Interface for this, but what I cant seem to find any information on is, it possible to create my own tags for this class? For example adding a "who took it" tag.
You're going to need a custom view and override the onDraw method of the view. In the onDraw method you get a reference to a Canvas object. From there, you can do most of whatever drawing you need. If you want to take user input and draw with it, you're going to have to override the touch events, and keep track of what you want to draw and then draw in the onDraw method.
As for Exif data. If you want to develop for before Android 2.0, then you need a 3rd party library, I use sanselanandroid personally. If you don't care about pre 2.0, I head ExifInterface works well too. It looks like you can save any arbitrary tag using ExifInterface because it just uses a string tag, and then string value, but know that only your app will know to read that tag.