Robert_d1968 Posted December 11, 2020 Share Posted December 11, 2020 Hello there. Im making a PVP game and I have made a moon in the game for PVP purposes. The only catch is that when you go towards the side of the planet. you fall off of it. Is there anyway to generate gravity in a model of the moon? Thanks for any help you can provide, Robert Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted December 11, 2020 Share Posted December 11, 2020 You can turn off world gravity and use addforce() per physics object. But it wont work with the character controller, which is sad. Quote Link to comment Share on other sites More sharing options...
Genebris Posted December 11, 2020 Share Posted December 11, 2020 Yes, you would need to use regular rigid body for characters instead of character controller. But then you run into different laggy behaviors with movement. Really unfortunate but current character controller is very limiting. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 12, 2020 Share Posted December 12, 2020 On 12/11/2020 at 2:29 AM, Robert_d1968 said: Hello there. Im making a PVP game and I have made a moon in the game for PVP purposes. The only catch is that when you go towards the side of the planet. you fall off of it. Is there anyway to generate gravity in a model of the moon? Thanks for any help you can provide, Robert I don't understand this. Gravity would point towards the center of the planet, so how can you fall off it? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Robert_d1968 Posted December 12, 2020 Author Share Posted December 12, 2020 I made a sphere for a moon and when you walk to the side. the character falls towards the ground and hits the land mass below. The moon has no gravity so the character just falls off of it when the sides come up. Robert Quote Link to comment Share on other sites More sharing options...
Josh Posted December 12, 2020 Share Posted December 12, 2020 Ah, I see, that is what you want to avoid. You could rotate the moon so it is always below the player. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Robert_d1968 Posted December 12, 2020 Author Share Posted December 12, 2020 Thanks for the idea. I will try that one out. Robert PS I do however foresee a problem with that, as it will be a multi player game and rotating the planet may put other players on the side of the moon. That may make them fall off the moon also. But it will be something I will try out. Quote Link to comment Share on other sites More sharing options...
Robert_d1968 Posted December 12, 2020 Author Share Posted December 12, 2020 Is there a pre-made script for Addforce already in leadwerks 4.7? If not how would I go about making a script in Lua for this purpose? Thanks for any help you can provide, Robert Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted December 12, 2020 Share Posted December 12, 2020 You need to add the force to the entity in the update world loop. Quote Link to comment Share on other sites More sharing options...
Robert_d1968 Posted December 12, 2020 Author Share Posted December 12, 2020 Thank-you, I will try that out. Quote Link to comment Share on other sites More sharing options...
Robert_d1968 Posted December 15, 2020 Author Share Posted December 15, 2020 Will this require a script to achieve this? Thanks for any help that you can provide, Robert Quote Link to comment Share on other sites More sharing options...
Staplers Posted January 8, 2021 Share Posted January 8, 2021 The old Windows Game Programming for Dummies came with a demo disk. On it was a 2d game with planets where you'd fire things and they had gravity behaving the way you're describing. Unfortunately, the game was named something that's also a popular name for other games. Of which I forgot the exact name of. I believe it was "Deadlock", even though that's also a 4x game that I happen to have played as well. If anyone can find that game, you might have a lead on the type of math you need. Of course, it's just math, and if you can recreate a gravity equation, which I believe is the same as the magnet equation, (Force in relation to distance, something squared, blah) or just fake it by creating a fall-off distance where the force is greatly reduced after N units or something, you should be good. Long story short, your problem is a math problem and you may be forced to dive into trig at the easiest, calc otherwise, and there's no getting around. Find someone who can do the equations if you can't, or go watch the tuts on game math throughout the internet. I admittedly only have surface knowledge of linear alg and whatever calc from HS. Quote 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.