Benderama's Forum Posts

  • The code you have there should work, but there must be something else that is affecting the camera.

    There's not really enough info here to be able to pin down the problem. It could be some code elsewhere that's interacting with your camera causing an issue such as your movement code. I would get some text elements on there displaying the various values to monitor what's going on as you move though to try to nail down any anomalies for example displaying your FPS would be a good start to at least eliminate lag as being the cause.

  • Well... I'm pretty much convinced at this point it's just a flaw with the default parameters they have coded for the effects.

    Looking into the process of making an effect it looks like there's a parameter that can be defined in the addon file that affects how far outside the view the effect will be rendered. I suspect this parameter is related to the issue described.

    And there doesn't seem to be any way to easily edit them from within Construct or the addon manager. Which is a little disappointing to be honest.

    In any case, I found and loaded up a 3rd party effect called Ripple from the asset store and it doesn't suffer from the same problem at all. So it's clear it has something to do with how the stock effects are configured rather than just an engine flaw.

    So currently, the only solutions I can see from my own research and bountiful replies to this thread are:

    1. Trying to find a means of adjusting the settings in the stock effects if I can find the files on the system.

    2. Making my own effects as addons that work properly.

    3. Using other 3rd party effects from the asset store.

    4. Using other means of mimicking effects via various layering, motion and sprite animations.

    5. Bugging the Construct team to fix the problem

  • Here's an idea I think may work if you're looking for instant real-time feedback you're going the wrong way...

    1. Add a fence on at least one side of your track (or just an invisible sprite)

    2. Add a unique sprite on the left and a unique sprite on the right side of your car.

    3. Assuming the wall you added will always be on the left if you're going straight - Every tick check if the left side sprite on the car is closer to the wall than the right side sprite.

    I would think the left side of your vehicle should always be closer to the left side of the track if you're going the right direction, right?

    Of course you can add extra layers of checks like if the right side is closer for more than X seconds, or elevation checks if your track overlaps...etc. this might prevent some glitches.

  • Looks very cool. Immediately reminds me of Shadowgate on the NES.

  • I'm trying to set up some water in my game. I've created a simple blue sprite which has the "Water" effect applied to it so it ripples a bit.

    I have the layout scroll to my player object position and as I move around the ripples work as you would expect where they are attached to the sprite and the flow is not interrupted or affected by the camera movement.

    That is until the sprite with the effect applied gets close to the edge of the view...

    As the sprite approaches the edge of the view the ripples no longer flow as you would expect, they seem to be affected by the edge of the view port which causes them to squish and distort, almost like it's calculating that the ripple effect has to stop at the edge of the view rather than the edge of the sprite which continues beyond the current view area

    Needless to say this is a very unnatural aesthetic that one wouldn't expect to see as a camera passes over a water background lol. Just wondering if there is some option or setting that I'm missing to correct this issue. It seems to happen with all effects, the crystal ball effect for example. it will distort a sprite on load and when you pan the camera around and it remain unchanged until it reaches the edge of the view where it then dynamically changes based on how much of the sprite is in the view. Hoping there is a way to adjust this...

    Thanks!

    UPDATE: I'm still looking into this and see this issue definitely exists with any effect that's applied to a sprite, even bumpmapping. Any effect that's been applied to something gets all skewed whenever the sprite with the effect applied gets close to the edge of the view. Frankly, I'm very surprised I haven't seen more people bringing up this issue. I've tried applying effects to an entire layer rather than just a sprite and it seems to reduce the issue (at the cost of more granular control over how the effect looks on a specific sprite) but there's definite artifacting that still happens to those sprites at the edge of the view. So not a real solution I guess.

    It's a little disheartening as the more I'm experimenting and researching the more I'm hoping this isn't just "the way it is". I can't be the only person to ever try to have a sprite with an effect leave or get close to the edge of the view and noticed this issue.

    Thanks again to anyone else looking into this.

  • Well I figured it out...

    More polish required but in essence I did the following and it seems to work as I hoped.

    1. Added an event for W is down with 1 action:

    3DCamera - move-along-camera-axis

    distance:"10"

    axis:"forward"

    which:"both"

    2. Added an event for S is down with 1 action:

    3DCamera - move-along-camera-axis

    distance:"-10"

    axis:"forward"

    which:"both"

    3. Added an event for Mouse on Movement with 2 actions:

    3DCamera - rotate-camera

    rotate-x:"Mouse.MovementX / 10"

    rotate-y:"Mouse.MovementY / 10"

    min-polar-angle:"20"

    max-polar-angle:"160"

    3DCamera - look-at-position

    cam-x:"3DCamera.CameraX"

    cam-y:"3DCamera.CameraY"

    cam-z:"3DCamera.CameraZ"

    look-x:"3DCamera.LookX"

    look-y:"3DCamera.LookY"

    look-z:"3DCamera.LookZ"

    up-x:"0"

    up-y:"0"

    up-z:"1"

  • there are multiple example projects with a camera like this, I recommend checking them out in the example browser

    Can you name a specific one? Cause I didn't see anything specifically.

    First-Person platformer for example can look around and you'll move in the direction you're looking but if I look up at the sky and try to move I don't start going up in the sky - and that's what I'm looking to do - not being tied to a plane.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I really hope this is something simple I'm missing here...

    I'm trying to get a first person 3D camera that I can move in the direction I'm looking in 3D space not tied to a single plane of movement.

    Think like Descent... A first-person game where you use the mouse to look around anywhere in 3D space and when you push W you move towards the specific point you are looking at in 3D space.

    I've got the mouse on movement event trigging to rotate the camera with this:

    {"is-c3-clipboard-data":true,"type":"actions","items":[{"id":"rotate-camera","objectClass":"3DCamera","parameters":{"rotate-x":"Mouse.MovementX / 10","rotate-y":"Mouse.MovementY / 10","min-polar-angle":"20","max-polar-angle":"160"}}]}

    And I've got the for when pushing W:

    {"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"key-is-down","objectClass":"Keyboard","parameters":{"key":87}}],"actions":[{"id":"move-along-camera-axis","objectClass":"3DCamera","parameters":{"distance":"1","axis":"forward","which":"both"}}]}]}

    Instead of moving in the direction I'm facing though I'm just moving along a single axis regardless of where I'm looking.

    The description for the "Move along camera axis" action specifically says "Move the camera and/or look position along axes relative to the direction he camera is pointing in" but that's not what it seems to be doing.

    Any ideas?

    Thanks

  • Thanks, I probably should have mentioned that I've got different object types.

    I'm trying to create windows/panels which are 9-patches and under those could be sprite objects.

    I think just adding a condition of if Mouse cursor is not over the panel to click events of things will do the trick.

  • Is it possible to only trigger a click event on an object if there isn't another object over top of it?

  • Sorry, I forgot to mention in regards to your solution I also don't believe it will work because there's too many other variables like the shape and obstructions. It might work ok if you've got a clear shot from the camera to the object and it's a box. But if it's a pyramid and/or it's partially obstructed from the camera and you click on it... Gonna be some crazy math to figure if it's actually being clicked on.

  • I don't think it can work as there's no ability to set a Z axis for the line of sight behavior (Or pretty much any existing functions).

    I was messing around with basically firing a sprite from the camera to where the user clicks by means of the move to behavior and manually adjusting the z elevation of the sprite as it moved which can sort of work because collisions are detected. But ran into issues with regards to speed and the thing moving so fast it was going through the object being clicked on and not detected.

    So my solution thus far is instead of having the behavior move the sprit is to create a loop based on the distance from the camera to the click location and iterating through moving the sprite 1 px at a time and checking for collision.

    First test seemed to work but lots of tweaking is needed. But now I'm thinking "ok, so that could work for clicks but what about hovering?"

    The mechanics of using this just seem so horribly inefficient. I really think the correct solution here is for the devs to actually code this simple functionality into the game engine.

    Thanks for your suggestion though

  • According to that thread it's a feature not a bug. Oh well, workaround works great thanks!

  • Use the line of sight behavior to cast a ray. On intersect, check the angle of the click with the hit distance and compare with the object height and z elevation.

    This is where you lost me... Not sure where I'm seeing options for angle of click or hit distance.

  • Trying to figure out why this doesn't work as expected. Basically, I've got a right click event with a sub event that spawns objects based on an array contents then a second sub event after that which tries to count/manipulate those newly created objects. However Construct doesn't seem to be aware that those objects exist until after the entire event and all sub events have fired. And even then it can mess up counts.

    See this project for a demo.

    1drv.ms/u/s!AsCiRwGRl1ngnJMAafrdXhe_nf9ihg

    In the demo right click on the screen and it will spawn 5 boxes. There is a text field that is supposed to display how many boxes there are just after they are created but it says 0. Additionally, the directive after that to change the box sizes doesn't work because it doesn't think there are any boxes. Then if you right click again it thinks there are 10 boxes where there are only 5 and the size directive still doesn't fire.

    Any insight here would be appreciated.

    I'm using r268