alice-teacher Object in Camera View

Tom Stokke tstokke at cs.und.edu
Sat Jan 19 15:30:27 EST 2013


Hey Don, Laurie, and et. al.,

Here is a quick attempt, I think you could make it work. I added a couple of 3-D text objects, the text is just 10 dashes, add more for the desired length. I just wanted an object that was essentially long, short and skinny. I'm sure there is a better object, I didn't work very hard at looking. Maybe a billboard with a long, short image would work well.

I made two 3-D images and positioned them at the limits or edges of what I can see from the camera. Maybe you'd want them just out of sight, it depends upon what you're trying to do. In a "real" world I suspect you would want to make them invisible.

Now I just continually check to see it the desired object is between the two "edges". Because of the quirks of the 3-D text I had to check to see if the car was in front of one edge and behind the other. It had to do with how I turned them either 90° or 270° when positioning them. You'd probably have the same issue with a billboard. You might want to check distance from the edges for more accuracy. I just going for "proof of concept, which is code for me being too lazy to really did into it right now :-).

If the objects are stationary and the camera moves make the vehicle for the edges be the camera.

It's very rough but I think it should work. If I get back to creating tutorials for how to do different "tricks" or "techniques" this is definitely one I'd add to the collection.

Let me know if and how it works for you. If anyone cleans it up and gets it working well let us know.

Tom
That guy from North Dakota
________________________________
From: alice-teachers-bounces+tstokke=cs.und.edu at lists.andrew.cmu.edu [alice-teachers-bounces+tstokke=cs.und.edu at lists.andrew.cmu.edu] on behalf of Don Slater [dslater at andrew.cmu.edu]
Sent: Thursday, January 17, 2013 12:23 PM
To: Laurie Dutchen; Alice Teachers
Subject: Re: alice-teacher Object in Camera View

On Jan 17, 2013, at 1:04 PM, Laurie Dutchen <ldutche at glencove.k12.ny.us<mailto:ldutche at glencove.k12.ny.us>> wrote:

HELP!!!

I have a student who is trying to complete a project and we have hit a brick wall!

He wants to be able to determine when an object comes into the camera’s view.  How can we do that?

Thanks,
Laurie Dutchen
Math/Computer Science Teacher
Glen Cove High School
Glen Cove, NY

<Reply from Don Slater; others may have different and better thoughts>

That is an interesting and difficult question… Ask the student to think about it this way, how do they know when they have walked into the view of a camera that is pointed in their general direction.

Virtually impossible, unless there has been some indicators for the students to let them know that they are now in view, i.e. a sign that tells them "You are now in view of the camera" and / or another sign that tells them "You are now leaving the view of the camera". So what they might do is put a marker in the center of the camera view, make it invisible, figure out how far to the left or right of the marker the object can be and still be in camera view, and then check the distance:

For example, the student figures out that an object can be 2.5 meters to the left or 2.5 meters to the right of the marker and still be in the camera view. So the conditional statement will be something like

if obj.distance to marker is less than 2.5 meters
// obj is in camera view; do what the obj should do

There are some assumptions here, that the obj and the marker are in line, and the camera is static (not moving)

If the object is not in line with the marker than the distance value may have to be tweaked…

If the camera is moving, than set the marker's vehicle to be the camera, so that as the camera moves, the marker moves with it, maintaining its relative position.

Let me know if you have any other questions. I am also going to post this question to the Alice Educator's Mailing list to see if what other solutions are out there.

All the best,
Don Slater


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20130119/c4877b03/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inCameraView.a2w
Type: application/octet-stream
Size: 203027 bytes
Desc: inCameraView.a2w
Url : http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20130119/c4877b03/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot.59.jpg
Type: image/jpeg
Size: 228653 bytes
Desc: screenshot.59.jpg
Url : http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20130119/c4877b03/attachment-0001.jpg 


More information about the alice-teachers mailing list