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

#1 2012-01-30 08:42:27

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

How to create a 3D illusion

Amazing 3D projects are visible all over Scratch, so I had the idea of making a tutorial for it!

TL;DR notice: This is a pretty short tutorial, you should read it all.

Steps
1. Calculating the properties
2. Changing the variables to your choice

Step 1. Calculating the properties
Add this script to the three-dimensional sprite of your choice.
**If anything goes wrong, please tell me! I have not tested this script.**

when gf clicked
forever
hide
set stretch to (((tilt) / (length)) * (100)) // stretching is a hackable block
set size to (zpos)%
set x to (xpos) // We need the variable to calculate visible x position
set y to (ypos) // See above
clear // We especially need to be able to clear only a certain sprite's pen trails...
repeat ((((tilt) / (length)) * (-100)) + (100))
move ((length) / (100)) steps
stamp
end
set [xpos v] to ((x) + ((zpos) * ((x) / (240))))
set [ypos v] to ((y) + ((zpos) * ((y) / (240))))
Step 2. Changing the variables
Simply change these variables:
(tilt)
(zpos)
(length)
(x)
(y)
and then you can program normally using these variables to move the object instead, creating an awesome 3D game.

That is the end of this short tutorial. I hope you have learned from this!

Last edited by rdococ (2012-02-18 15:41:19)

Offline

 

#2 2012-01-30 09:43:43

veggieman001
Scratcher
Registered: 2010-02-20
Posts: 1000+

Re: How to create a 3D illusion

What are the blockspecs for set stretch?


Posts: 20000 - Show all posts

Offline

 

#3 2012-01-30 10:03:15

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: How to create a 3D illusion

The blockspecs for stretch are:

('set stretch to %n' #- #setStretchTo:)
and
('change stretch by %n' #- #changeStretchBy:)

Offline

 

#4 2012-04-08 05:58:47

taumich
Scratcher
Registered: 2010-05-08
Posts: 15

Re: How to create a 3D illusion

I made a very good ilkusion engine without the stretsh block. I still have it in my homepage.

Offline

 

#5 2012-04-09 03:03:22

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: How to create a 3D illusion

You can use stamping to create 3D that changes with perspective  smile


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

Board footer