Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not a issue with your code but a issue with me #1

Open
Therealjosephchrzempiec opened this issue Jul 5, 2021 · 43 comments
Open

Not a issue with your code but a issue with me #1

Therealjosephchrzempiec opened this issue Jul 5, 2021 · 43 comments

Comments

@Therealjosephchrzempiec
Copy link

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

@kennardconsulting
Copy link
Owner

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.

@Therealjosephchrzempiec
Copy link
Author

Hello, Thank you for the reply back. What if I put like a transparent say wall around the whole track. would that work?

joseph

@kennardconsulting
Copy link
Owner

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).

@Therealjosephchrzempiec
Copy link
Author

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

@Therealjosephchrzempiec
Copy link
Author

Therealjosephchrzempiec commented Nov 18, 2021

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

@kennardconsulting
Copy link
Owner

kennardconsulting commented Nov 18, 2021

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":

image

@Therealjosephchrzempiec
Copy link
Author

Therealjosephchrzempiec commented Nov 18, 2021

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`

@kennardconsulting
Copy link
Owner

You can't use 'curvedimage'. Use plane instead.

@Therealjosephchrzempiec
Copy link
Author

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.

@kennardconsulting
Copy link
Owner

You'll need at least 4 planes. One for each edge. Look at my example of a 'back room' of a house

@Therealjosephchrzempiec
Copy link
Author

Therealjosephchrzempiec commented Nov 18, 2021

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.

Untitled2

My coding is not so good But I'm trying.

@kennardconsulting
Copy link
Owner

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.

@Therealjosephchrzempiec
Copy link
Author

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.

@kennardconsulting
Copy link
Owner

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.

@Therealjosephchrzempiec
Copy link
Author

Can you please give me a link? Because I can not find it or the example code?

@kennardconsulting
Copy link
Owner

image

@Therealjosephchrzempiec
Copy link
Author

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.

@kennardconsulting
Copy link
Owner

My code contains some things (like 'mixin') which you'll have to remove. Look up a tutorial on how to use a-plane.

@Therealjosephchrzempiec
Copy link
Author

Therealjosephchrzempiec commented Nov 18, 2021

I don't have mixin in mine.
That is the screenshot of mine currently as it is.

Untitled3

@kennardconsulting
Copy link
Owner

  1. I cannot see if you have closed your tags properly (they go off the screen).
  2. I would strongly recommend you indent your code properly.
  3. If adding some code breaks your page, look closely at that particular code

@kennardconsulting
Copy link
Owner

  1. You have spelt 'flase' wrong

@kennardconsulting
Copy link
Owner

  1. Single quotes 'red' are not valid HTML syntax. Must be double quotes.

@kennardconsulting
Copy link
Owner

  1. Check the JavaScript console. It will normally report errors

@Therealjosephchrzempiec
Copy link
Author

Therealjosephchrzempiec commented Nov 18, 2021

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.

Untitled5

@kennardconsulting
Copy link
Owner

Paste the code (not a screenshot) so I can copy/paste

@Therealjosephchrzempiec
Copy link
Author

It will not let me paste whole thing. So i uploaded to pastebin. https://pastebin.com/aeKL92Zu

@kennardconsulting
Copy link
Owner

kennardconsulting commented Nov 18, 2021

aframe.zip

@Therealjosephchrzempiec
Copy link
Author

This is very strange. I laoded your code and It is a complete blank aframe. Here is a screen shot.

Untitled7

@Therealjosephchrzempiec
Copy link
Author

Therealjosephchrzempiec commented Nov 18, 2021

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.

@kennardconsulting
Copy link
Owner

It works fine for me. I'm sorry I cannot help your further.

@Therealjosephchrzempiec
Copy link
Author

Let me load this to my hosting and see if it works.

@Therealjosephchrzempiec
Copy link
Author

Therealjosephchrzempiec commented Nov 18, 2021

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.

@kennardconsulting
Copy link
Owner

CORS, probably. Check your JavaScript console.

@Therealjosephchrzempiec
Copy link
Author

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)

@kennardconsulting
Copy link
Owner

I just fixed that for you. Get a fresh copy of reset-on-collision.js

@Therealjosephchrzempiec
Copy link
Author

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

@kennardconsulting
Copy link
Owner

Yes

@Therealjosephchrzempiec
Copy link
Author

Do i apply it the same way? I have a OBJ building with MLT texture images.

Joseph

@kennardconsulting
Copy link
Owner

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.

@Therealjosephchrzempiec
Copy link
Author

The building i have and found is from here https://www.cgtrader.com/free-3d-models/exterior/industrial/modular-warehouse

Joseph

@Therealjosephchrzempiec
Copy link
Author

Okay, I hope I can try tis. Thank you

Joseph

@Therealjosephchrzempiec
Copy link
Author

Therealjosephchrzempiec commented Nov 21, 2021

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

@Therealjosephchrzempiec
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants