Geometrycontroller window... wtf?

About advanced scenes, and the Thyme scripting language used in Algodoo.

Geometrycontroller window... wtf?

Postby PlanckBanck » Mon Nov 23, 2009 11:24 pm

so, my first problem is that i don`t know how to spawn something with a position relatve to a collide-point.
What I mean is, when I write :
Code: Select all
scene.addcircle({ pos := [1; 0.1]; Blah Blah})

i spawns relative to the middle of the scene, but how do I do it relatively to the collision?
So, that was the really nooby stuff, now the less nooby stuff...

how to spawn complex objects / defined (and how to define them lol) polygons?

Thanks to everyone who even reads this xD
PlanckBanck
Last edited by PlanckBanck on Sun Dec 06, 2009 1:06 am, edited 2 times in total.
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: Spawning complex object and spawning relative to e.pos

Postby standardtoaster » Tue Nov 24, 2009 12:50 am

You were very close with your script. You don't separate the X and Y positions with a semicolon. You use a comma.
Code: Select all
pos := [1, 0.1]

Rating: rated 7.2
Filesize: 6.39 kB
Comments: 6
Ratings: 7
download

You can find out about polygons with this scene. After you load the scene make a box, go to its script menu, go down to the text field, and type {"" + scene.my.vecs}
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Spawning complex object and spawning relative to e.pos

Postby PlanckBanck » Tue Nov 24, 2009 1:11 am

wow, thanks for quick answer, just going to try it ^^

Edit: Tried it, and it still spawns just relative to scenemiddle. whem I move the position of contact, the spawnpoint stays the same... any other ideas? xD
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: Spawning complex object and spawning relative to e.pos

Postby standardtoaster » Tue Nov 24, 2009 1:30 am

That's because you told it to spawn it at a fixed position. To spawn it where it hits use e.pos.
Code: Select all
pos := e.pos
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Spawning complex object and spawning relative to e.pos

Postby niffirg1 » Tue Nov 24, 2009 6:45 am

Oh mabye you are looking for this
Code: Select all
pos := [e.pos(0) - 1, e.pos(1) - 1]
That will spawn something 1 point to the left and one point down.
Tip- E.pos(0) is horizontal and (1) is vertical
User avatar
niffirg1
 
Posts: 376
Joined: Mon Aug 31, 2009 10:31 pm
Location: The Great American South!

Re: Spawning complex object and spawning relative to e.pos

Postby PlanckBanck » Tue Nov 24, 2009 11:24 pm

now you got it! xD thanks

edit: I hop noone minds if I just keep using this for asking stuff? ^^
Posting new threads is always so... annoying
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: Spawning complex object and spawning relative to e.pos

Postby standardtoaster » Tue Nov 24, 2009 11:42 pm

It's okay to keep re using this thread. Just remember to change the title of the thread when you do it.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Spawning complex object and spawning relative to e.pos

Postby PlanckBanck » Wed Nov 25, 2009 12:33 am

Kay, thx
Okay, next question, there is no way to detect the velocity of an xisting object to make a spawning object have the same velocity, right? ^^
dunno, read it somewhere...

PS: and spawning phunlets ^^
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: Detecting velocity of existing object

Postby RA2lover » Wed Nov 25, 2009 2:36 am

1- yes, you can, but you'll need to use math to do that. i've made a simple water spawner to demonstrate it(hovewer due to phun imprecisions, its not too accurate)
Rating: rated 5
Filesize: 39.36 kB
Comments: 0
Ratings: 1
download

2-yes, but you'll need to have ALL of it specified into some VEEEERY long likes of text, and even by then you'll have some problems spawning. an example is this spring bullet spawner. objects can stick to it if spawning too fast, and other problems can occour.
Rating: rated 6.1
Filesize: 9.99 kB
Comments: 4
Ratings: 3
download

you'll need tools to replace the "=" in the phunlets with ":=", also, you'l need to remove the command line"//phunlet created by x y.z", remove body measures(in most cases), remove paragraphs and line breaks for it.
Jrv wrote:
TC42 wrote:Quite honestly, I didn't think anyone on 4chan has that good a use of grammar, spelling, usage, mechanics, ect.
But I've never been there, so I may be wrong.


GTFO newfgt
User avatar
RA2lover
 
Posts: 607
Joined: Mon Aug 31, 2009 8:43 pm
Location: Brazil

Re: Detecting velocity of existing object

Postby standardtoaster » Wed Nov 25, 2009 3:35 am

I would also suggest that you remove all lines that have entityID.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Detecting velocity of existing object

Postby PlanckBanck » Wed Nov 25, 2009 10:42 pm

okay, you used like 7 things i don`t know or even ever heard of... but hay, thanks xD
1,2 and 3 are for that phunlet thingy, are they saved in some kind of spawning script or what? that`d be interesting and what the heck shall "//phunlet created by x y.z" mean?
also what is an entity ID? xD like geomID? cuz I never understood those ^^

Edit: okay, I swept the coding of the ammo-spawner-gun and I`ll write down the things I don`t know:
Texturematrix
EntityID
body
zdepth
legacymode (springs)
relpoint(tracer/pen)

Hell, that`s a lot, just help me if you`re in the mood to, I don`t wanna bother you, but a huge thanks for helping me this far anyway!

Greetings, PlanckBanck

PS: You two seem to be quite helpful around here, thanks a lot, people are morons all around the globe, especially in the Internet, so I give a great thanks to everyone helping out us noobs! :P
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: Detecting velocity of existing object

Postby standardtoaster » Wed Nov 25, 2009 11:54 pm

Code: Select all
// Phunlet created by Algodoo v1.6.0

FileInfo -> {
    title = "";
    version = 6
};
Scene.addCircle {
    color = [0.892, 0.841, 0.058, 1.0];
    entityID = 334;
    zDepth = 293.0;
    geomID = 7212;
    pos = [0.75, 4.25];
    angle = -1.4994454;
    radius = 1.0
}

That is the code of a circle with a radius of one meter.
Code: Select all
//Phunlet created by Algodoo v1.6.0

That just tells you what it was made with; but it has, //, which is a comment operator. If you use that in the spawn script it will reject it. That is why you need to take that out.

Basically, just remove everything from //Phunlet created by Algodoo to Scene.addCircle(or box, polygon, pen, etc.)

Code: Select all
entityID = 334

As far as I know(from experience), entityID is almost the same as geomID except it will cause massive errors if you spawn more than one thing with the same entityID. That needs to be removed when you make the spawn script.
Code: Select all
zDepth = 293.0

zDepth is the z-order, or layering of objects. That line is optional. If you want to spawn the object behind everything use zDepth = -inf or zDepth = 0. zDepth = -inf will ensure that it will stay behind everything but you won't be able to select it without encircling it. zDepth = 0 will work as long as you don't send anything to the back or front in the rest of the scene. It's your choice.
Code: Select all
pos = [0.75, 4.25]

Pos is the position of the object in Cartesian coordinates. Pos(0) will give you the X axis. Pos(1) will give you the Y axis.
Code: Select all
angle = -1.4994454

Angle is the angle of the object in radians.
Code: Select all
radius = 1.0

Radius is, well, the radius of the circle. :)

The textureMatrix is a list that has nine(9) different parts. Here's how it goes:
Code: Select all
textureMatrix(0) = width of the texture
textureMatrix(1) = skews the texture on the X axis
textureMatrix(2) = the X position of the texture on the object
textureMatrix(3) = skews the texture on the Y axis
textureMatrix(4) = height of the texture
textureMatrix(5) = the Y position of the texture on the object
textureMatrix(6) = pinches the texture on the X axis(only works on polygons)
textureMatrix(7) = pinches the texture on the Y axis(only works on polygons)
textureMatrix(8) = zoom of the texture(only works on polygons)


The body of an object tells Algodoo/Phun what things should be glued to each other. Two geometries with different bodies will not be glued together.
Code: Select all
scene.addCircle({pos := app.mousePos; body := 1}); scene.addCircle({pos := app.mousePos + [1, 1]; body := 2})

Those two circles will not be glued together. However, if they have the same body they will be.
Code: Select all
scene.addCircle({pos := app.mousePos; body := 1}); scene.addCircle({pos := app.mousePos + [1, 1]; body := 1})

Those two circles will be glued to each other.

The legacyMode of a spring(from what I remember RA2lover saying), tells Algodoo what solver to use for the springs.
Code: Select all
legacyMode = 0 ----- That would give you springs that act like Phun beta 5
legacyMode = 1 ----- That would give you springs that act like they were in private beta testing
legacyMode = 2 ----- That would give you springs that act like they normally do in Algodoo

Those properties can only be used on springs.

The relPoint of a laser or pen is the same thing as the position of an object, but for some reason it won't work when spawning something. You should substitute relPoint for pos when spawning things.
Code: Select all
scene.addLaserPen({relPoint := app.mousePos})

That will give you an error for some unknown reason.
Code: Select all
scene.addLaserPen({pos := app.mousePos})

That will spawn a laser at the mouse position.

In order for you to spawn things around a certain point you need to add the differences in location to it. First you need to define the point at which everything will be centered around. Let's use scene.my.pos as the example.
Code: Select all
scene.my.pos = [4, 3]

Let's say that you have two circles that you want to spawn with the correct disposition.
Code: Select all
scene.addCircle({pos = [1, 3]}); scene.addCircle({pos = [4, 3]})

As you can see, the second circle is what we have defined as the point at which everything will be centered around. Now, here comes the math.

In order to get the right displacement you need to subtract the X axis of the defined point(second circle in this case) from the X axis of the other circle. Do the same with the Y axes.
Code: Select all
scene.addCircle({pos = scene.my.pos}); scene.addCircle({pos = [scene.my.pos(0) + (1-4), scene.my.pos(1) + (3-3)]})


Do you get what I mean? Does this answer your questions?
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Detecting velocity of existing object

Postby PlanckBanck » Thu Nov 26, 2009 11:24 am

Wow, I actually got everything you said, but I a impressed bey the effort you made just for answering my noobish questions xD Thanks a very lot dude!
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: Geometrycontroller window... wtf?

Postby PlanckBanck » Sun Dec 06, 2009 1:29 am

Hell, what is the Geometrycontroller window... yeah, you can put controllers in there, but there is some other use to it, right? I saw a scene, with controlleracc := +inf and no controller input at all...

PS: @Ra2lover... I know this is cheap but hay! xD
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: Geometrycontroller window... wtf?

Postby standardtoaster » Sun Dec 06, 2009 3:30 am

You don't need to have a controller set to a geometry to modify the controllerAcc.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 6 guests

cron