Foxmander's Recent Forum Activity

  • r271 still haven't fixed this issue.

  • Oh strange. I didn’t test it but that sounds like a bug then.

    Guess you could move the camera forward by one, save it’s position to variables. Then move back one and subtract the position from the same variables. That would give you a forward vector xyz.

    Thanks again. I apologize if I do not understand something, but this solution does not work either.

  • do you want to shoot the bullet in the direction the camera is facing or do you want to shoot towards the enemy no matter what?

    For both first you need to add three instance variables to the bullet sprite for the velocity. I like to use vx,vy and vz.

    Then to make the sprite move you'd add an event like this:

    every tick
    -- sprite: set x to self.x+self.vx*dt 
    -- sprite: set y to self.y+self.vy*dt 
    -- sprite: set zelevation to self.zelevation+self.vz*dt 

    Now to shoot forward you'd set the velocities like this when you create the bullet:

    on click
    -- create sprite at (3dcamera.cameraX, 3dcamera.cameraY)
    -- sprite: set zelevation to 3dcamera.cameraZ
    -- sprite: set vx to 100*3dcamera.forwardX
    -- sprite: set vy to 100*3dcamera.forwardY
    -- sprite: set vz to 100*3dcamera.forwardZ 

    The 100 is the speed.

    To just shoot toward the enemy you'd do this:

    global number factor=0
    
    on click
    -- create sprite at (3dcamera.cameraX, 3dcamera.cameraY)
    -- sprite: set zelevation to 3dcamera.cameraZ
    -- sprite: set vx to enemy.x-3dcamera.cameraX
    -- sprite: set vy to enemy.y-3dcamera.cameraY
    -- sprite: set vz to enemy.zelevation-3dcamera.cameraZ
    -- set factor to 100/sqrt(sprite.vx^2+sprite.vy^2+sprite.vz^2)
    -- sprite: set vx to self.vx*factor
    -- sprite: set vy to self.vy*factor
    -- sprite: set vz to self.vz*factor

    Thanks for your response! It seems like ForwardX/Y/Z does not change for me when I move my camera. I even tried ths expressions in Scirra's "3D Platformer" example, but unsuccessfully.

  • tan(angle) will get you the slope of your camera angle. Multiply that by the distance and zscale to get the z height at any given distance. Remember to also add the z height of the origin/camera as well.

    Thanks for your response! Your solution will work with raytrace, but what I am trying to achieve is to make flying visible bullet, which may be a little harder to implement.

    I tried multiplying bullet's Z elevation by 3DCamera's LookZ every tick, but it seems to be wrong. Any ideas?

  • Hey. With C3's recently added 3D camera feature I started experementing with it's possibilities and stuck on making shooting FPS mechanic.

    Imagine an enemy, standing on the high ground. How do I reach him from below?

    How do I make a bullet that will fly up and down in the direction of my view?

    Thanks

  • Hey!

    Recently I've spent a few hours to implement raycast technique in Construct 3. So I've got a question: is there a way to create items like medkits in doom of ammo in wolf3D? And how do I actually calculate height of the walls? Currently I am using screen.height-ray.width, but is seems like it's curved and weird sometimes

    If anyone got interested, I could pin .c3p file.

  • Well I meant its features like improved vibration and adaptive triggers

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello! Any news 'bout Dualsense and it's features support?

  • For some reason I can't make a post in the General Discussions thread, so I decided to ask here

    Is there now or are there plans to support DualSense? I mean its features like adaptive triggers or advanced vibration.

  • I mean fuck you

  • OMG how do i do this? So hard interface there

  • It works, but now, when mouse hits the border nothing happens. That was the main problem ;/

Foxmander's avatar

Foxmander

Member since 29 Jun, 2017

None one is following Foxmander yet!

Trophy Case

  • 7-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

10/44
How to earn trophies