Browse Search Popular Register Upload Rules User list Login:
Search:
Mouse/Camera Followers

Image:
screenshot of the scene

Author: FruitMonger

Group: Default

Filesize: 18.69 kB

Date added: 2012-09-29

Rating: 5

Downloads: 625

Views: 597

Comments: 9

Ratings: 1

Times favored: 0

Made with: Algodoo v2.0.2 Edu

Tags:

Scene tag

Two thruster powered followers. One follows the mouse cursor, one follows the camera, and both are powered by their circles' controller accelerations, to make it simpler to change the follow strength.

In order to change the srength, right click one of the circles to bring up the context menu, and go down to the C ontroller category. From there, change the Controller acceleration, and the follower's strength will change with it.
Last edited at 2012/09/29 04:06:01 by FruitMonger
Please log in to rate this scene
edit
Similar scenes
Title: Controllable Camera
Rating: 5
Filesize: 36.51 kB
Downloads: 630
Comments: 0
Ratings: 1
Date added: 2022/02/21 11:08:53
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: 3D Polygon Renderer V1.1
Rating: 5
Filesize: 7.02 kB
Downloads: 757
Comments: 4
Ratings: 1
Date added: 2024/05/03 18:12:36
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: "The Alien" Ragdoll
Rating: 6.5
Filesize: 0.7 MB
Downloads: 502
Comments: 3
Ratings: 6
Date added: 2008/11/02 01:41:45
Made with: Phun
Rating: rated 6.5
download
Title: Just a random mouse-following claw
Rating: 5
Filesize: 11.29 kB
Downloads: 1276
Comments: 4
Ratings: 1
Date added: 2022/03/27 02:51:32
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Focus camera ¿?
Rating: 5
Filesize: 23 kB
Downloads: 651
Comments: 3
Ratings: 1
Date added: 2014/05/19 22:44:17
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Tank game techdemo
Rating: 8.3007
Filesize: 409.84 kB
Downloads: 2521
Comments: 13
Ratings: 16
Date added: 2009/11/08 12:43:34
Made with: Algodoo before v1.8.5
Rating: rated 8.3
download
Very cool! Nice Job! :tup:

I use a lot of Thyme script in my scenes, but I'm not familiar with scene.entityByGeomID. Could you please explain what that command is and what it does?

Also, could you briefly explain the entire script in each case (mouse follow and camera follow)? I don't fully understand how they work just by reading it. A verbal explanation would be helpful and very much appreciated!

Thanks!
Well, I'm not that experienced with scene.entityByGeomID, so you might be better off asking on the forums if you want all the details, but I believe it basically finds an entity within the scene using readables (variables that you can read, but not change), and then allows you to use that entity for its variables and stuff.

As for the followers, it's actually quite simple, once you understand how to use scene.entityByGeomID.

Basically, there's a script that I use along with scene.entityByGeomID that assigns the circle the name "A", and then you can use the circle's variables, like pos and radius, for anything you want. (the script is "a := Scene.entityByGeomID((readable(entity)).geom)"(For fixates and hinged you want it like this:
a := Scene.entityByGeomID((readable(entity)).geom1);
b := Scene.entityByGeomID((readable(entity)).geom0)))

For the mouse follower:

The mouse follower takes A (remember, A = circle) and extracts its pos, then finds the difference between app.mousepos and the circle's pos (app.mousepos is the position of the mouse cursor in the simulation), and assigns the X/Y pos difference to the X/Y thrusters, but multiplies it by 50 or so.

For the camera follower:

The camera follower is basically the same as the mouse follower, but instead of using app.mousepos, it uses scene.camera.pan instead.

And that's about all there is to it. If you need any more info, feel free to ask, and if you don't understand a part of my explanation (which is somewhat likely, because as of now it's about 12:10 A.M. where I am), I'll try to explain it better/further.

Hope that helps. Have a nice day :) .
(Or, you know, night :P )
Nice demo and explanation. Circle rotation can be minimized by placing the thrusters over each other at the center of the circle (not that it matters). Very large values of gain (Controller acceleration) will cause the circle to fly off into oblivion, but this is expected behavior.
Thanks, Fruitmonger! That explanation helped a great deal, although I'm still a little fuzzy about it. The best way to learn is by doing, so I'll play with that script, and then it will start to make sense after a while.

Thanks again!
Xray
Why the script that you wrote on the thruster isn't suitable for Algodoo V2.0.1?:(
@faytree:

There are differences between 2.0.1 and 2.0.2 scripting, and that's probably why. I believe there are more scriptable variables on geometries in v.2.0.2 (like pos, radius, vel, etc.), and it uses those variables.
Last edited at 2012/10/03 19:10:20 by FruitMonger
Thanks for telling me!:) now i understand the differences between 2.0.1 and 2.0.2.And you got a subscribe!
frutmonger - I played around with this scene, and found that I can acheive the exact same mouse following function, but in a much simpler fashion. I got rid of the thrusters, and in the circle "pos" I put {app.mousepos}. Now the circle is stuck to the mouse cursor, and it follows it around perfectly without spinning!
@Xray:

Yes, you can do it that way, and I've actually done that with one of my scenes, but it's no fun to do it that way ;) .

Also, you can't have anything connected to the follower if you do it that way. Try it out, it screws stuff up.

And if you just want it to stop spinning, you can make its inertiamultiplier +inf, and it won't be able to spin.