Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » List based raycasting troubles!! Please help!! (3d game)
- FluffyKittens321
-
Scratcher
66 posts
List based raycasting troubles!! Please help!! (3d game)
I'm working on a list based raycaster, but it doesn't work properly. I cannot move in the map I assigned to it or look around. Please help!! I got the scripts from https://en.scratch-wiki.info/wiki/Raycaster and this is my second attempt. Still does not work :c
- deck26
-
Scratcher
1000+ posts
List based raycasting troubles!! Please help!! (3d game)
Have you tried the sprite based option to get the hang of how things work?
It looks to me as if the wiki page is incomplete or has errors - I can't see anywhere at the moment that the variables X Direction and Y Direction (as used when you press up/down) are set to anything other than 0. It may be that those should be Direction X and Direction Y.
I know it can feel easier to use your own variable names than the ones in the wiki page but that can also lead to confusion. Try renaming your variables so they match and check the scripts again. It may be that you've created two different variables where there should only be one.
Your best bet otherwise may be finding other projects of this type.
It looks to me as if the wiki page is incomplete or has errors - I can't see anywhere at the moment that the variables X Direction and Y Direction (as used when you press up/down) are set to anything other than 0. It may be that those should be Direction X and Direction Y.
I know it can feel easier to use your own variable names than the ones in the wiki page but that can also lead to confusion. Try renaming your variables so they match and check the scripts again. It may be that you've created two different variables where there should only be one.
Your best bet otherwise may be finding other projects of this type.
- FluffyKittens321
-
Scratcher
66 posts
List based raycasting troubles!! Please help!! (3d game)
Have you tried the sprite based option to get the hang of how things work?Well, I've done the sprite based ray caster, and it seems to be fine. My only issue,
It looks to me as if the wiki page is incomplete or has errors - I can't see anywhere at the moment that the variables X Direction and Y Direction (as used when you press up/down) are set to anything other than 0. It may be that those should be Direction X and Direction Y.
I know it can feel easier to use your own variable names than the ones in the wiki page but that can also lead to confusion. Try renaming your variables so they match and check the scripts again. It may be that you've created two different variables where there should only be one.
Your best bet otherwise may be finding other projects of this type.
is is uncomfortably laggy. I'm talking 3 FPS tops! The list based ray caster is way more optimized, and I see my FPS at around 15-20. 15-20 actually looks like motion while 3 fps seems like a slideshow. I tried the list based ray caster again, and right now I am working on camera movement. I can walk around but my left right controls spaz whenever I press them
- deck26
-
Scratcher
1000+ posts
List based raycasting troubles!! Please help!! (3d game)
Are you saying you now have it working other than for left/right movement?
- FluffyKittens321
-
Scratcher
66 posts
List based raycasting troubles!! Please help!! (3d game)
Are you saying you now have it working other than for left/right movement?Yep, and I am having some issues with collisions. My player can just clip out of the world (and this crashes the game by making it lag immensely lol)
- FluffyKittens321
-
Scratcher
66 posts
List based raycasting troubles!! Please help!! (3d game)
Are you saying you now have it working other than for left/right movement?Want me to upload the project?
- deck26
-
Scratcher
1000+ posts
List based raycasting troubles!! Please help!! (3d game)
Yes. I may not be able to help but someone else may spot something.Are you saying you now have it working other than for left/right movement?Want me to upload the project?
- FluffyKittens321
-
Scratcher
66 posts
List based raycasting troubles!! Please help!! (3d game)
I've uploaded it. You should see it on my profile.Yes. I may not be able to help but someone else may spot something.Are you saying you now have it working other than for left/right movement?Want me to upload the project?
- deck26
-
Scratcher
1000+ posts
List based raycasting troubles!! Please help!! (3d game)
I see you tried my suggestion for up/down keys and that presumably helped. Did you try my suggestion on the variable names to check they're all set up properly?
- FluffyKittens321
-
Scratcher
66 posts
List based raycasting troubles!! Please help!! (3d game)
I see you tried my suggestion for up/down keys and that presumably helped. Did you try my suggestion on the variable names to check they're all set up properly?I've been checking them. None of them seem to be out of place. I will correct my self if I find an error
- FluffyKittens321
-
Scratcher
66 posts
List based raycasting troubles!! Please help!! (3d game)
I see you tried my suggestion for up/down keys and that presumably helped. Did you try my suggestion on the variable names to check they're all set up properly?I found a project using the same mechanics and I plan on ripping some code from it to get mine working, if I find issues I need to resolve.
- deck26
-
Scratcher
1000+ posts
List based raycasting troubles!! Please help!! (3d game)
Why have you set those limits for rotation speed? cos and sin of a near 0 value are going to mean not much change. Give it a maximum value of 45 or 90 and see what happens. Setting it to 0 I suspect means not much happens.
- FluffyKittens321
-
Scratcher
66 posts
List based raycasting troubles!! Please help!! (3d game)
Why have you set those limits for rotation speed? cos and sin of a near 0 value are going to mean not much change. Give it a maximum value of 45 or 90 and see what happens. Setting it to 0 I suspect means not much happens.What do you mean limits? Which part are you referring to?
- FluffyKittens321
-
Scratcher
66 posts
List based raycasting troubles!! Please help!! (3d game)
Why have you set those limits for rotation speed? cos and sin of a near 0 value are going to mean not much change. Give it a maximum value of 45 or 90 and see what happens. Setting it to 0 I suspect means not much happens.90 makes the rendering go boom while 45 makes the game crash
- deck26
-
Scratcher
1000+ posts
List based raycasting troubles!! Please help!! (3d game)
You've set the variable up with a slider and set the value to be limited to between 0 and 0.2. If you set a maximum value of 45 you can at least experiment with values like 1, 5, 10 etc to see what works.Why have you set those limits for rotation speed? cos and sin of a near 0 value are going to mean not much change. Give it a maximum value of 45 or 90 and see what happens. Setting it to 0 I suspect means not much happens.What do you mean limits? Which part are you referring to?
Same goes for the movespeed - give yourself a bigger range of values at least while testing.
- FluffyKittens321
-
Scratcher
66 posts
List based raycasting troubles!! Please help!! (3d game)
I have to go to bed. I'll talk in a few days due to homework troubles.You've set the variable up with a slider and set the value to be limited to between 0 and 0.2. If you set a maximum value of 45 you can at least experiment with values like 1, 5, 10 etc to see what works.Why have you set those limits for rotation speed? cos and sin of a near 0 value are going to mean not much change. Give it a maximum value of 45 or 90 and see what happens. Setting it to 0 I suspect means not much happens.What do you mean limits? Which part are you referring to?
Same goes for the movespeed - give yourself a bigger range of values at least while testing.
* math
- FluffyKittens321
-
Scratcher
66 posts
List based raycasting troubles!! Please help!! (3d game)
I'm available today. I am retrying the raycaster exactly how the wiki showed it. Lets see how it goes!You've set the variable up with a slider and set the value to be limited to between 0 and 0.2. If you set a maximum value of 45 you can at least experiment with values like 1, 5, 10 etc to see what works.Why have you set those limits for rotation speed? cos and sin of a near 0 value are going to mean not much change. Give it a maximum value of 45 or 90 and see what happens. Setting it to 0 I suspect means not much happens.What do you mean limits? Which part are you referring to?
Same goes for the movespeed - give yourself a bigger range of values at least while testing.
- Discussion Forums
- » Help with Scripts
-
» List based raycasting troubles!! Please help!! (3d game)