ScratchData LogoScratchData
Back to chooper-beta's profile

Dodgy-but-working 3D quad support

CHchooper-beta•Created April 15, 2017
Dodgy-but-working 3D quad support
48
41
1561 views
View on Scratch

Instructions

Controls: WASD..............Move player Arrow keys.......Rotate camera Space..............Jump Shift................Crouch M....................Toggle mouse controls O....................Show options P.....................Pause F.....................Toggle FPS Counter

Description

The theory behind the way this works is using the fake surface method I described in the comments on the project I remixed Inside the 'load quad' block, instead of calling the 'int load tri' block to load surfaces, we use a block I created for this project, called "load quad into tri". The "load quad into tri" block is nearly identical to the "int load tri" block, except that, even when the surface is fully visible, a fake tri surface will always be created for it. This means that the inputs for P1, P2 and P3 are respected as they are what get put in the fake surface. (Otherwise, the P1, P2 and P3 coordinates would have no effect on what was rendered) You might also notice that the 'Draw quad' block now does nothing. This is because we convert the quads into 2 fake triangles, meaning that the "draw surfaces" block will never find any quads. Note that, at this point, it is far simpler to instead to change the "add quad surface" block in the objects sprite to simply call "add tri surface" twice. (Because ultimately that's what we end up doing - just treating a quad as 2 tris) However, the ultimate benefit of this method though is that the developer can still access a quad as a single surface (and therefore only have to set the texture once, etc.) (Btw, another issue in the original code which probably didn't help was that, on the second 'int load tri' block in the 'load quad surface' block, you used P2 for the second input, but it should have been P1)

Project Details

Project ID155709839
CreatedApril 15, 2017
Last ModifiedMay 4, 2024
SharedApril 15, 2017
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root