cassius Posted May 10, 2018 Share Posted May 10, 2018 I asked similar question a long time ago but never implemented the replies I got. I need to reference the y coord of my character so that it can die if it falls off the top of a high building. maybe over 30 ft high. How would this code look? Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
gamecreator Posted May 10, 2018 Share Posted May 10, 2018 If you're just looking to get the y position, you can get that with yourentityname->GetPosition().y; Quote Link to comment Share on other sites More sharing options...
Crazycarpet Posted May 10, 2018 Share Posted May 10, 2018 I'm too lazy to write the code, but you could do a pick downwards to see if there's 30ft of no collisions (or at least to confirm the actor isn't touching the ground), then set a variable in your character, 'falling', to true and store their current y position... In your UpdateWorld loop for this actor check if the player is 'falling', subtract the actors starting 'y' position from when they were marked as 'falling' from the current 'y' position and if that difference is 30 ft or over kill em. Edit: - You should code an IsOnGround() method for your actor, and use that to set 'falling' to false in the UpdateWorld loop if they are marked as 'faliling' but IsOnGround() is true. Quote Link to comment Share on other sites More sharing options...
cassius Posted May 10, 2018 Author Share Posted May 10, 2018 Thanks. That's a good starting point. But maybe a raytrace might work too? Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.