Open Therealjosephchrzempiec opened 3 years ago
Hi there. I'm afraid my code probably won't be very good for a racing game. It uses AABB collision, which means all the walls have to be either 0, 90, 180, or 270 degrees. You can't have any 'diagonal' walls. So it's good for a maze game, for example.
Hello, Thank you for the reply back. What if I put like a transparent say wall around the whole track. would that work?
joseph
Yes, sure - that would stop people leaving the raceway entirely. But it's not going to stop people coming off the track at individual corners (i.e. going 'on to the grass') and you wouldn't be able to use it for track barriers around certain corners (as they would need to be placed diagonally). But it would be fine for barriers along the straights and/or the pits/stands (as they can all be axis aligned, I imagine).
I have walls that are the same as the whole track. I took them out because it looked funny to me. It covered the whole track. The track is in the sky track. I can put the walls back and make them transparent. So it will cover the whole track on both sides.
Joseph
Hello. Do you have a example on how to not walk through walls. I' having a hard time setting up your code please?
Edit: This is what I have.
<a-curvedimage src="border.png" radius="500" position="300 20 0" theta-length="360" height="4" rotation="0 0 0" opacity="1" side="double" scale="1 1 10" reset-on-collision="with: .wall"></a-curvedimage>
Can you tell me what I'm doing wrong. I'm sorry I'm new to all this. I have a border around my whole scene.
Joseph
You're thinking about this wrong.
You must have an entity (the player) that has reset-on-collision="with: .wall"
Then you create walls that are aligned AABB (i.e. not diagonal) and give them a class="wall":
Hello is this correct?
`a-curvedimage class="wall" src="border.png" radius="500" position="300 20 0" theta-length="360" height="4" rotation="0 0 0" opacity="1" side="double" scale="10 10 10">
a-entity camera reset-on-collision="with: .wall" look-controls wasd-controls="acceleration:200" position="160 20 -50"></a-entity`
You can't use 'curvedimage'. Use plane instead.
Not sure how to make a Plane around the whole scene so no one can go off the edge? Sorry I'm not very good at coding. It is what I found online and modded to add to my own scene.
You'll need at least 4 planes. One for each edge. Look at my example of a 'back room' of a house
Hello I'm just trying to upload a box for text to walk through and I got this. But when I try to refresh my scene webpage the scene won't load.
My coding is not so good But I'm trying.
The wall must be AABB. So rotation of 0 0 200 isn't good. Look at my example. Everything is 0 90 0 or 0 180 0 or similar.
Hello I can not find a example But a art gallery one and That for some odd reason doesn't load. I change the rotation. However I can still not load the scene it comes up blank for some odd reason.
It's not a standalone example. It's a bit of code from an art gallery project I wrote.
But you can see it has planes for walls and a moving player. Just copy the planes for the walls and the player and put it in a project of your own. You should see the collision detection.
Can you please give me a link? Because I can not find it or the example code?
Hello, I did follow your wall. But the whole scene will not load now. If I take out the plane wall then The scene loads with no problem.
My code contains some things (like 'mixin') which you'll have to remove. Look up a tutorial on how to use a-plane.
I don't have mixin in mine. That is the screenshot of mine currently as it is.
I have clean things up a little and took out the building I have then change from a single qote to a double quote in the red. But the scene will not load. I also fixed the false from flase. Still again nothing loads.
Paste the code (not a screenshot) so I can copy/paste
It will not let me paste whole thing. So i uploaded to pastebin. https://pastebin.com/aeKL92Zu
This is very strange. I laoded your code and It is a complete blank aframe. Here is a screen shot.
I do not know why It is blank. If i take out the wall your plane for the collision part I can load the aframe with no problem.
Edit: I also put your reset-on-collision in the main area of the index.html page.
It works fine for me. I'm sorry I cannot help your further.
Let me load this to my hosting and see if it works.
OMG I can not believe it works in my godaddy hosting but bot in my localhosting. I wonder why is that?
Thank you so much for the help.
CORS, probably. Check your JavaScript console.
Yup there is something there. I totally forgot to check that.
Uncaught TypeError: Cannot read properties of undefined (reading 'constructor') at extendProperties (component.js:736) at i.callUpdateHandler (component.js:416) at i.updateProperties (component.js:300) at HTMLElement.value (a-entity.js:490) at HTMLElement.<anonymous> (a-entity.js:727) at i.tick (reset-on-collision.js:41) at HTMLElement.value (a-scene.js:740) at HTMLElement.value (a-scene.js:790) at bind.js:12 at u (three.js:19157)
I just fixed that for you. Get a fresh copy of reset-on-collision.js
Hello, I have one question. Would this work for a building to stop walking through the wallsbut Still can let the person walk through the door?
Joseph
Yes
Do i apply it the same way? I have a OBJ building with MLT texture images.
Joseph
No that won't work. It would have to be a building constructed manually out of planes. Or you could probably use a OBJ and put invisible planes around it.
The building i have and found is from here https://www.cgtrader.com/free-3d-models/exterior/industrial/modular-warehouse
Joseph
Okay, I hope I can try tis. Thank you
Joseph
Hello just a update. Everything is working great in local. however If i push my way through the red or blue wall I can get through If i keep pushing on the up arrow key. I just wanted to let you know.
Joseph
Hello kennard, I'm sorry I have been away dealing with family and my depression. But I'm back at dealing with this whole walking through the wall problem.
I have tried your demo. If I keep trying to walk through the wall. It keeps pushing me back. However after I keep pushing through it I can get through the wall.
Is there a way to stop that?
Joseph
Hello I'm not very good with coding but there is my problem. I have a track for a game I'm working on. I'm trying not to go off the track. I searched online and trying to find a way not to go through walls or off track. I found your github page. Would this help me and do you have a example i can take a look at please? I tried your code but I got a little confused trying to set it up with my aframe.
Joseph