I have two problems for my project

Here is the link: https://playcanvas.com/project/809740/overview/webrelax

My first problem is the first person camera. At a certain angle, it rotates weirdly. I don’t know how this is possible because I literally copied it from the tutorial page.

My second problem (rather question) is the water. How can I move the normal in a direction (or maybe even vary it) to make it look like it actually moves?

Thank you very much in advance

Hi @SayHiToMePls,

The issue is you are scaling the parent Relaxer entity, and that produces the weird behavior on the physics body and the camera. Set the scale back to 1,1,1 and it will work quite fine:

image

There are several way to do that, the simplest way I can think would be to animate in a code script the water material tiling. Check this example for a simple way to do that:

https://developer.playcanvas.com/en/tutorials/animated-textures/

More complex ways would involve writing a custom shader, here is a custom water share example:

https://developer.playcanvas.com/en/tutorials/simple-water-surface/

1 Like

Finally

I was worried that my questions would stay unanswered.

Thank you very much

1 Like

I just have one question left:

In the tutorial for animated textures, there is a small block of code. When I try to implement it into my project, it says

Cannot read property 'set' of undefined

How can I fix this or where is the problem?

What exact code produces that error? The error will be coming with a line number and an active link to the script in question. Try to locate that and share that code.

    tmp.set(this.speed.x, this.speed.y);

there is the problem

Maybe you haven’t used the full code provided in the example project?

https://playcanvas.com/editor/scene/440164

tmp is being declared on line 11:

this also might be the actual problem

well, now it says

Cannot read property 'x' of null

This getting weirder than I expected

Ok, so now I found the actual problem:

I forgot to parse the script in the first place.

:sweat: Mistakes make me stronger, unlike the people who made Avatar the last Airbender

1 Like