Level and screen projections (now with resize handling)

Post your example zscripts/ACS scripts/etc here.

Re: Level and screen projections (now with resize handling)

Postby Apeirogon » Sat Aug 03, 2019 7:54 am

I seen that, what I mean is that IMO license terms must be available from the "front page" of the library.

And about comments, just comment what result of reorient/deproject/etc. functions, to make it clear what they do and which you must override to add some explosions and music to it.
User avatar
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: Level and screen projections (now with resize handling)

Postby Cherno » Wed Sep 18, 2019 1:12 pm

EDIT: I found the solution.I somply changed the camera's CameraFOV property and wit works flawlessly now, and I can even remove the cam texture.

Hello,

first of all, thanks for this library. Most of the math is beyond my understand but I can see that is must have been a ton of work.

I am using a camera texture to view the world from an almost isometric overhead projection (fov 18). Think the old game Desert Strike. However, is seems like the library will only use the "real" viewport fov. If I use the isometric cam as a real viewport via ChangeCamera so it replaces the player's view, stuff gets drawn correctly at an actor's screen position (like a target indicator). However, when drawing teh camera texture above it, it uses the narrow fov of 18 so I wonder how this could be solveD? I see no way to make the library use a specific fov in it's computations.
User avatar
Cherno
 
Joined: 06 Dec 2016

Re: Level and screen projections (now with resize handling)

Postby KeksDose » Wed Sep 18, 2019 2:00 pm

Odd, cuz it sounds like you'd just wanna set CacheFov(18). I guess having no camera texture at all is better, though.

Cherno wrote:Most of the math is beyond my understand but I can see that is must have been a ton of work.

I appreciate the notion. Maths is my job though, so it was a cinch.
User avatar
KeksDose
Praise Mima and the Moon
 
 
 
Joined: 05 Jul 2007

Re: Level and screen projections (now with resize handling)

Postby kodi » Tue Oct 15, 2019 1:46 pm

I was wondering if I could suggest a feature that may be out of scope for the library: A function that efficiently rotates pitch and angle arguments supplied to it. I'm using libeye for cursor aiming and would like to make some weapons with randomized spread 8-)
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: Level and screen projections (now with resize handling)

Postby KeksDose » Tue Oct 15, 2019 2:45 pm

Can be arranged. Dunno if outta scope (audience groans pun) but I only gave it the name libeye to have a food pun on ribeye steaks.

nice smartgun btw haha
User avatar
KeksDose
Praise Mima and the Moon
 
 
 
Joined: 05 Jul 2007

Re: Level and screen projections (now with resize handling)

Postby kodi » Tue Oct 15, 2019 3:05 pm

Can be arranged

Much appreciated!!!
but I only gave it the name libeye to have a food pun on ribeye steaks.

I had not realized this, and I almost think I was better off for it :mrgreen:
nice smartgun btw haha

Hah, thanks. It's quite satisfying to use against zombiemen.
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: Level and screen projections (now with resize handling)

Postby Major Cooke » Tue Aug 25, 2020 2:29 pm

I can see from the bounding box example that checking for something in the frustrum is possible, but I'm wondering if this can be used to also affect things?

I've been told some examples like frustrum culling for Minecraft-esque blocks may help with performance when there's thousands of actors. Naturally, the idea is to ignore all actors that have the INVISIBLE or 'None' RenderStyle property, or sprite/frame of TNT1 A.

But at the same time this does seem like it's heavily going to be subject to UI rules which means it'll be next to impossible.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: Level and screen projections (now with resize handling)

Postby Night Falls » Fri Aug 27, 2021 10:25 pm

Is there any way I could make it so the free aim is from the perspective of a camera instead of the player or get the world coordinates of where the cursor is pointing?
User avatar
Night Falls
 
Joined: 09 Mar 2020
Location: A hole in the bottom of the sea
Operating System: Windows 10/8.1/8/201x 64-bit

Re: Level and screen projections (now with resize handling)

Postby KeksDose » Sat Aug 28, 2021 2:07 pm

Yea! It'll depend on what you wanna do, but in general, directions you get from the cursor will be from the perspective of what you describe in the "Orient" functions. By proj.OrientForPlayer(some_player_info); you tell the projector "I want a player actor to be the perspective". You can instead use proj.Reorient(camera.pos, (camera.angle, camera.pitch, camera.roll)); and the projector will now assume that the camera is the perspective. All you need is the actor reference of the camera you wanna use.

In the free aim example, you also have this line: cursor_mo = data.hitactor; where data is the result of a line trace. You can use vector3 hit_pos = data.hitlocation; to get the world point the cursor is pointing at in that situation, from the camera view, and the tracer flags decide for which actors or map lines it'll stop. This line trace has to be done cuz the projector by itself really just gives you the direction of such a world position. Then you can do some maths to fire projectiles or bullets from the player towards that location or sth...
User avatar
KeksDose
Praise Mima and the Moon
 
 
 
Joined: 05 Jul 2007

Re: Level and screen projections (now with resize handling)

Postby Night Falls » Sat Aug 28, 2021 2:30 pm

Thanks! I've been poking around different things and can't figure out how to get the actor reference of the camera though.

Edit: Nevermind, just had to use worldthingspawned
User avatar
Night Falls
 
Joined: 09 Mar 2020
Location: A hole in the bottom of the sea
Operating System: Windows 10/8.1/8/201x 64-bit

Re: Level and screen projections (now with resize handling)

Postby Night Falls » Mon Aug 30, 2021 12:44 pm

KeksDose wrote:Yea! It'll depend on what you wanna do, but in general, directions you get from the cursor will be from the perspective of what you describe in the "Orient" functions. By proj.OrientForPlayer(some_player_info); you tell the projector "I want a player actor to be the perspective". You can instead use proj.Reorient(camera.pos, (camera.angle, camera.pitch, camera.roll)); and the projector will now assume that the camera is the perspective. All you need is the actor reference of the camera you wanna use.

In the free aim example, you also have this line: cursor_mo = data.hitactor; where data is the result of a line trace. You can use vector3 hit_pos = data.hitlocation; to get the world point the cursor is pointing at in that situation, from the camera view, and the tracer flags decide for which actors or map lines it'll stop. This line trace has to be done cuz the projector by itself really just gives you the direction of such a world position. Then you can do some maths to fire projectiles or bullets from the player towards that location or sth...


I got it all figured out and it works great! There was one other thing I had to do which is change
Code: Select allExpand view
po.LineTrace(
            cursor_ang,
            25000.13376669,
            cursor_vang,
            TRF_THRUBLOCK | TRF_THRUHITSCAN,
            offsetz: player.viewheight,
            data: data);   

to
Code: Select allExpand view
         camera.LineTrace(
            cursor_ang,
            25000.13376669,
            cursor_vang,
            TRF_THRUBLOCK | TRF_THRUHITSCAN,
            offsetz: player.viewheight,
            data: data);


The only issue is that the actor used as the pointer and the on-screen pointer are usually a short distance apart depending on the angle I'm pointing. If I can't get them totally in sync it'd be fine to just only have the actor mouse pointer since it's more accurate anyways.
Thanks for your help and code! This was exactly what I needed for my project.
User avatar
Night Falls
 
Joined: 09 Mar 2020
Location: A hole in the bottom of the sea
Operating System: Windows 10/8.1/8/201x 64-bit

Re: Level and screen projections (now with resize handling)

Postby KeksDose » Tue Aug 31, 2021 4:11 pm

Looking good! I think the offset is due to the tracer being fired from offsetz: player.viewheight still. Try offsetz: camera.cameraheight, or maybe even plain 0?
User avatar
KeksDose
Praise Mima and the Moon
 
 
 
Joined: 05 Jul 2007

Re: Level and screen projections (now with resize handling)

Postby Night Falls » Tue Aug 31, 2021 6:10 pm

Thanks!
Though I honestly don't understand a lot of the math going on getting the hit location, I think the offset was just because the camera was looking down at an angle, and also because the cursor actor is in a 3D space and the HUD cursor is in a 2D space, so they didn't line up perfectly (the offset increased the further it got from the center of the screen).

Setting the offsetz to -10 got the two cursors close enough together, and with the way the aiming works in my mod the 3D space offset thing doesn't really affect the gameplay, so it's fine if it does that. I just set the in-world cursor to be invisible.

Weirdly though, switching offsetz to camera.viewheight made the in-world cursor invisible and the player's rotation (done by having him face the cursor) got all funky. Since I've just got it set to -10 it's not a problem though.
User avatar
Night Falls
 
Joined: 09 Mar 2020
Location: A hole in the bottom of the sea
Operating System: Windows 10/8.1/8/201x 64-bit

Previous

Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests