This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-06-14 10:59:56

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

How do I make it so that...?

when an object gets closer, (in a 3D game) the closer it gets the faster it's size grows?


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#2 2011-06-14 11:12:01

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: How do I make it so that...?

You could have the size increase inversely proportional to the "distance" to the object - for example [Change size by 1/distance]. This probably would make the increase too fast, but you should be able to get a good value if you work with it a bit, maybe changing the value to 2 or something along those lines.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#3 2011-06-14 11:24:00

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

Re: How do I make it so that...?

Harakou wrote:

You could have the size increase inversely proportional to the "distance" to the object - for example [Change size by 1/distance]. This probably would make the increase too fast, but you should be able to get a good value if you work with it a bit, maybe changing the value to 2 or something along those lines.

I can't really get it to work. Could you please have a go?


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#4 2011-06-14 11:34:00

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: How do I make it so that...?

calebxy wrote:

Harakou wrote:

You could have the size increase inversely proportional to the "distance" to the object - for example [Change size by 1/distance]. This probably would make the increase too fast, but you should be able to get a good value if you work with it a bit, maybe changing the value to 2 or something along those lines.

I can't really get it to work. Could you please have a go?

I don't really know what you're using to determine distance, but let me make an example for you. This script starts with the the distance to 10 units and the size at 100%, and then adjusts the size inversely to the distance.

http://i.imgur.com/TNWKn.gif

Last edited by Harakou (2011-06-14 11:38:55)


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#5 2011-06-14 12:38:26

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

Re: How do I make it so that...?

Harakou wrote:

calebxy wrote:

Harakou wrote:

You could have the size increase inversely proportional to the "distance" to the object - for example [Change size by 1/distance]. This probably would make the increase too fast, but you should be able to get a good value if you work with it a bit, maybe changing the value to 2 or something along those lines.

I can't really get it to work. Could you please have a go?

I don't really know what you're using to determine distance, but let me make an example for you. This script starts with the the distance to 10 units and the size at 100%, and then adjusts the size inversely to the distance.

http://i.imgur.com/TNWKn.gif

It won't let me press down.

Edit: Never mind.  tongue

Last edited by calebxy (2011-06-14 12:39:01)


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#6 2011-06-14 12:41:16

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

Re: How do I make it so that...?

Harakou wrote:

calebxy wrote:

Harakou wrote:

You could have the size increase inversely proportional to the "distance" to the object - for example [Change size by 1/distance]. This probably would make the increase too fast, but you should be able to get a good value if you work with it a bit, maybe changing the value to 2 or something along those lines.

I can't really get it to work. Could you please have a go?

I don't really know what you're using to determine distance, but let me make an example for you. This script starts with the the distance to 10 units and the size at 100%, and then adjusts the size inversely to the distance.

http://i.imgur.com/TNWKn.gif

Thank you very much. That works!  big_smile


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#7 2011-06-14 12:43:54

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

Re: How do I make it so that...?

Sorry to be a bother, (and I probably sound really stupid saying this) but how do I do that same thing with the Y position?


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#8 2011-06-14 12:56:11

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: How do I make it so that...?

What do you mean with the y position?


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#9 2011-06-14 12:59:08

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

Re: How do I make it so that...?

Harakou wrote:

What do you mean with the y position?

Well, in a 3D game, the object would get bigger, and move down the screen, both of which have the same problem.


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#10 2011-06-14 13:04:26

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: How do I make it so that...?

calebxy wrote:

Harakou wrote:

What do you mean with the y position?

Well, in a 3D game, the object would get bigger, and move down the screen, both of which have the same problem.

Oh. Well I suppose it would be relatively easy to do a similar thing with y position; just multiply the expression by -1 and adjust it a bit so that the values for y would match correctly. (It would probably be something like (-1000/distance) + 100.)


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#11 2011-06-14 13:28:01

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

Re: How do I make it so that...?

Harakou wrote:

calebxy wrote:

Harakou wrote:

What do you mean with the y position?

Well, in a 3D game, the object would get bigger, and move down the screen, both of which have the same problem.

Oh. Well I suppose it would be relatively easy to do a similar thing with y position; just multiply the expression by -1 and adjust it a bit so that the values for y would match correctly. (It would probably be something like (-1000/distance) + 100.)

Thanks you, that works brilliantly.  smile


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#12 2011-06-14 13:43:59

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: How do I make it so that...?

calebxy wrote:

Harakou wrote:

calebxy wrote:


Well, in a 3D game, the object would get bigger, and move down the screen, both of which have the same problem.

Oh. Well I suppose it would be relatively easy to do a similar thing with y position; just multiply the expression by -1 and adjust it a bit so that the values for y would match correctly. (It would probably be something like (-1000/distance) + 100.)

Thanks you, that works brilliantly.  smile

No problem.  smile


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#13 2011-06-14 13:47:19

peterkap
Scratcher
Registered: 2009-01-24
Posts: 1000+

Re: How do I make it so that...?

Aslo, maybe you should wait until Scratch3D comes out to have no problems with making 3D games and it looks more realistic.

Last edited by peterkap (2011-06-14 13:48:17)

Offline

 

Board footer