DIV ARENA FORUMS

get_angle in Mode 8

steffen87 - 15-4-2022 at 08:03 AM

Hello everyone!

I want the m8-camera facing a process, but it didn't work. Is this not possible in mode 8 or am I doing something wrong?

angle = get_angle(...)

Should also be working for the m8 cam, right?

This is what I want to do:
in my game is a tower and I want a short sequenz where the camera is going higher, thenfacing the middle of the tower and fly 360° around it, then flying back to the original position.

CicTec - 15-4-2022 at 08:55 AM

Hello,

Yes it is possible but with the use of more commands,

Open the DIV help with F1, look for the start_mode8 function and load the example it shows as code, run it and observe the environment, then study the commands it uses:
Code:
if(key(_right)) angle -= 5000; end if(key(_left)) angle += 5000; end if(key(_up)) advance(24); end if(key(_down)) advance(-9); end if(key(_q)) z += 16; end if(key(_a)) z -= 16; end if(key(_w)) m8.angle += 8; end if(key(_s)) m8.angle -= 8; end

left / right = control the angle of the camera in the vertical axis (for the observer it is equivalent to turning on himself 360 ° inside a room for example)
up / down = control the distance of the camera from the focal point (for the observer it is equivalent to approaching or moving away from a wall of a room we are observing for example)
q / a = controls the height of the camera (for the observer this is the same as looking at the room from the floor, climbing a ladder or bending over his knees for example)
w / s = controls the angle or point of view of the camera (for the observer it is equivalent to looking at the environment of a room by lowering or raising his eyes, neck or both)

By combining these variables / functions appropriately you can simulate the effect you are looking for, a great start is to imagine one of the pillars of the external structure of the example as the tower, then use the commands to walk around it, go up / down, etc .. .

steffen87 - 15-4-2022 at 09:32 AM

I wanted to use xadvance (like in the wld_view example when pressing Alt+left/right) while at the same time the cam is looking at on point, so that you can see the tower in my game from all sides.

steffen87 - 15-4-2022 at 12:00 PM

It works! The camera now flies a perfect circle around the (not yet finished) tower. :)

The get_id was above LOOP, now below LOOP and it works.

CicTec - 15-4-2022 at 12:56 PM

Great. :)