Raycast success – Week 13
- Christopher Cromb
- Jan 4, 2021
- 2 min read
Updated: Nov 25, 2021
After lots of attempts to resolve my issues with the raycasting, I have found a solution. As the y position is not considered when making the toy move to a target, I initially tried moving the raycast prefabs above the town so it would definitely not get in the way of any raycasting. However the raycasts still went through each other without recognising the colliders. The solution I found was to instantiate the raycasting prefabs separately by making them spawn after the roads were placed using a script. This seems to have fixed all issues with the raycast, meaning the layermask was not necessary. The path around the entire town is always generated now which I will be using to make the toys walk around. Below is the raycasting prefabs showing how it all links up a path.
I have also made some more decorative elements for the town as I think having just trees appearing randomly would make it less visually distinct.
I have also developed a way to set the scale of the town as it will need to be bigger to fit toys able to walk along the pavement. I have already modified the roads to have colliders around the pavement, creating a path the toys can walk around without falling off onto the road. The movement I have for the toys is still quite shaky and I would like to improve on it, but it’s hard to get realistic movement without animations and just force on a skeleton. Below are the new roads colliders.
I also have plans to add the streetlamps onto more street positions but only have a chance to spawn so they are more evenly but randomly spread out.
Comments