Draw Line Connecting two Object/Vector3 Unity3d - unity3d

I am making game .
In that i will have points(Stations) already given and on hitting those points, line should be started to draw till it reached to next point.
as well as i want to avoid overlapping of lines.
and line should continue to expand if i touch end of the line.
I know 2 approaches to draw line
I can use linerenderer or else i can use GL class .
I want to know which will be suitable for my requirement. and if you guys is having another idea then also you can share.
I have seen vectrocity demo but its not free so i cant use.
Thank you guys for your help and support till now and help me to solve my confusion.

Use the LineRenderer for a reasonably limited number of lines. It's much easier to customize than GL.Lines, and it will let you work in Unity's coordinate system without dealing with transform matrices.
And a small note: Up until 4.x, only Pro had GL.Lines, and it didn't work on iOS, so most people were using other approaches. I've never seen anyone use GL.Lines outside of a demo specifically to compare the two approaches. GL.Lines performs better, but is limited in customization options. Another approach I've seen is using the Graphics class and procedural meshes.It's also faster than the LineRenderer, but takes a little work to implement. This article comapares all three approaches and has some code for using the Graphics class

For scene you can use GL.Lines or Debug.DrawLine or Debug.DrawRay. But this lines you can't see in your game. So use Line Renderer.
For you it can useful https://www.youtube.com/watch?v=Bqcu94VuVOI

Related

Rendering a 3D object from four different angles

I am working on a project where I have to render 4 different sides of a 3D object at the same time on the screen. The output should have 4 different camera outputs rendering the front side, left side, right side and back side of the 3d object.
I found that a gaming engine like Unity may help to do something like this. However, I have just started using Unity and can't figure out how to do it.
Here is the link for some examples. This is how I want the output to look like
Well first of all, welcome to Stackoverflow. And you are right, Unity is an excellent IDE to achieve what you described.
As stated in the FAQ and here, I'm going to give you an answer I deem fitting to your question. I can post the code here in about 30 minutes which does exactly what you asked for, but then we'd miss the point of learning to program and posting at StackOverflow in general. I'll show you the way on how to start on this project, but then you'll have to try yourself. If you have any troubles after trying some more, we can help you with specific problems, provided you have researched some before and show us what you tried.
As to your question, it's relative easy to do so. First create your object in the scene, then drag and place four different Camera-objects in the screen. Using the Camera's Normalized View Port Rect (Four values that indicate where on the screen this camera view will be drawn, in Screen Coordinates (values 0-1)), you can then split up the view to show the feed of each Camera.
This ofcourse happens in a script. You can read here about Scripting in Unity. Even if you are an expert in programming, that link is worth a read when you are new to Unity.
Good luck.

Matlab. Image processing on 8 ball pool flash game. Small cheat. Hehe

See the picture below. It's a flash game from a well known website :)
http://imageshack.us/photo/my-images/837/poolu.jpg/
I'd like to capture the images, frame by frame, using Matlab, and then lenghten the line that goes from the 8 ball, the short one, so i can see exactly where it will go. And display another window, in which the exact pool table will appear but with longer lines for the paths :)
I know, or can easily find out, how to capture the screen and whatnot, the problem is that i'm not sure how to start detecting those lines, to see the direction they are heading towards. Can anyone suggest an idea on how to accomplish this? Any image processing techniques i could use to at least filter out everything except those lines.
Not sure where to even start looking, or for WHAT.
And yeah, it's a cheat i know. But i got programming skills, why not put them in practice? :D Help me out people, it's a fun project :)
Thanks.
I would try using the Hough transform in the Matlab Image Processing Toolbox.
EDIT1:
Basically the Hough transform is a technique for detecting linear structures (lines) in an image.

Increase the call-frequency for the touchesMoved-method

I am currently working on an app, which includes a paint function. It actually doesn't work that bad, but the problem is, that the refresh-rate or the frequency of the calls for the touchesMoved-method is too bad.
If you move the fingers fast over the screen, the lines get many edges and it doesn't look that good. So i thought about increasing the call-frequency for this method. Would that be a good and even possible solution for my problem?
Maybe you can help me with my problem. Thank you in advance.
Think about this approach: Look at Adobe's Ideas App on the AppStore. If touchesEnd, work with NSBezierPath to get a smoother look without edges. You basically store the points in touchesMoved in an array? So you got the points to insert in the Bezier Path functions. You have a edgy look while drawing but after releasing it looks kind of smooth. I did so in one of my projects and result is fairly okay.
(But there are many other approaches to build a drawing application.)
Demo App from Apple: Click here

OpenGL - to use or not to use ? why - iPhone application dev

I have to develop an application "Behavior like an Tetris game".
I have never used "OpenGL" for the iPhone application developement.
Application is something like this
Red / green / blue square boxes drop from top
Red + Red + Red = Points & boxes disappears
same way user has to make combination & get points
Different levels are there.
There are three buttons Left, Right for movement & bottom for speedy fall
For this kind of application should I use open GL or NOT?
i.e. Is it possible to develop entire application with view & it's animation?
If yes then, will it be more complex as compare to open gl?
What is the advantage of using open GL?
(I know that it gives good 2d, 3d look )
(But here my question means - easy coding?)
(Or open gl is more complicated as compare to objective-c?)
(I am just asking because I am not aware of it)
Basically your options are:
Using OpenGL
Using Quartz
Using UIKit
OpenGL is a fairly complicated beast, but is by far the best way to squeeze performance out of the iPhone. Do you need it for a Tetris game, though? Almost certainly not.
Quartz is the toolkit used in Mac OS X and the iPhone to draw images and do image effects. Because I come from an OpenGL background in other languages, I find Quartz strange and frustrating. However, it is probably easier for someone who is new to both.
You can do everything here using UIKit, and it will definitely be much much easier than other options. The main disadvantage is that it's rather slow in comparison, but once again doing a Tetris-like game shouldn't matter at all.
Before you go with UIKit, though, I recommend just checking out something like Cocos 2D, which will give you the advantages of OpenGL without the headache of dealing with all of its inner workings.
From the tone of your question it looks like you're confusing what OpenGL is and isn't with regard to Objective-C.
OpenGL is a library written in the C programming language (to put it simplistically) that excels at rendering shapes (especially 3D shapes) for display on a screen. It doesn't replace Objective-C inside your program, it merely assists you in drawing the shapes. If you don't use OpenGL, you'll need to write some sort of drawing/rendering code in your NSView (or subclass) to render the blocks. By using OpenGL, you will be provided a lot of helpful C methods for drawing shapes, which otherwise you'll have to implement yourself. On top of that OpenGL has thousands of man hours worth of drawing optimizations that you can take advantage of if you use it rather than trying to implement shape rendering yourself.
Having said that, OpenGL isn't all sunshine and roses. It works like a state machine and has its own assumptions about the way it will be used (like any API). Just because you know C and Objective-C doesn't mean that using OpenGL will be trivial. If you've never written any OpenGL code, I suggest you look into a reference like the venerable Red Book.
The thing to keep in mind is that OpenGL is not a language until itself (ignoring the OpenGL shading language). Its merely a set of C functions to aid you in rendering graphics.
You may well want to ask as well on http://iphonegamedev.stackexchange.com/, the new Stack Overflow variant just for iPhone gaming.
To learn & understand what you need.
Please go through following link.
it includes all necessary links for all kind of resources that you needed.
http://maniacdev.com/2009/04/8-great-resources-for-learning-iphone-opengl-es/
Edit :
After reading your question properly ( actually my question - By r & d I found solution).
I think - you need to develop a 2d application.
Go for the following link. Best option for 2d animation.
http://code.google.com/p/cocos2d-iphone/
Don't forget to visit following link, if you needed sample codes.
http://monoclestudios.com/cocos2d_whitepaper.html

Recognizing patterns when drawing over the iPhone screen

I'm trying to write a game where the user can issue commands by drawing certain patterns with his fingers..for example, if he draws a circle, an 'S' letter, an expiral, etc.
I'm already familiar with touch events and I'm capable of reading the coordinates... my problem Is in finding algorithms and information about the recognition of the patterns with some degree of error.... for example, If I'm supposed to detect a circle I should detect it even if the user didn't did a make perfect one.
Any resources in the matter?, thanks !
This site demos a very simple, easy to implement gesture recognizer, which they wrote in Javascript. I've implemented it myself in another language, and found it quite easy to deal with. They've got code, and a paper describing the algorithm; everything you could need.
The patterns you're referring to are known as "gestures".
This code seems to be what you're looking for.