Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / How do I change an objects angle?

Author
Message
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 8th Oct 2018 16:24 Edited at: 8th Oct 2018 16:26
I tried to generate some simple hair:



Very pretty, yes? But I have some trouble with this line:
SetObjectRotation (hairObj[hairPiece], rndFloat(0.0,200.0) , rndFloat(0.0,200.0), rndFloat(0.0,200.0)) // YXZ

I want the hair pieces to spread out upwards, covering the top of the head. But I can't get the numbers right.



Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 8th Oct 2018 16:51 Edited at: 8th Oct 2018 16:56
Do you mean like this?



needed to use random2(from,too)
and needed negative numbers too
ive also attached the hair

anyway that code should help GOODLUCK
fubar
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 9th Oct 2018 12:35
Cool, that fixed it! I got a bit confused by fixObjectToObject. I forgot that it takes it current world position and use that as its position as relative to the parent ... this bit is hard to put into words, but at least I get it.

My rndFloat() was wrong? I thought it worked so well ... Thanks for finding that one too!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Oct 2018 13:01
Yourwelcome
Curious what the character ends up like when you've finished (nice to see stuff created by code)
PS Pity there isn't a save object command as of yet as you could then do the rest of the modelling in a program such as blender
But puzzler has made great progress with obj files loading adding etc (obj files really are just saved in text format)
this page of his demonstrates loading objects and adding to make one mesh
https://forum.thegamecreators.com/thread/222071?page=4
fubar
puzzler2018
User Banned
Posted: 9th Oct 2018 13:32
Thanks

SaveObject for coded primatives will soon to come, its on my to do list for the memblock project
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 9th Oct 2018 18:08 Edited at: 9th Oct 2018 18:10
Current status:



Her legs are bending backwards. I'm not aiming for realism, obviously, but it would be nice to be able to stop this. I think I'll fix invisible cube to the thigh which stops the lower leg from kicking out further.

The gravity separates her body from her head. I could lower the gravity, but that makes the physics look wonky. Guess I just makes her neck longer and call it a feature.

What I would really like would be the ability to actually see the collision boxes, as we can with sprites. (or was this fixed? I really cant remember)

Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Oct 2018 19:25 Edited at: 9th Oct 2018 19:27
That's pretty cool Basicfanatic


Quote: "What I would really like would be the ability to actually see the collision boxes, as we can with sprites."

Pretty sure we can [href]file:///C:/Program%20Files%20(x86)/Steam/steamapps/common/App%20Game%20Kit%202/Tier%201/Help/Reference/3DPhysics/Debug3DPhysicsWorld.htm[/href]
fubar
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 9th Oct 2018 21:44
Yup, I noticed that command too. But as it says: "Note: This command does not currently work needs the ability to draw wireframe in AGK. "
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 9th Oct 2018 22:29 Edited at: 9th Oct 2018 22:30
Here, the white cube fixed to her left thigh stops her from bending her knee in the wrong direction. I love it when something just works!

Attachments

Login to view attachments
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 10th Oct 2018 14:20
It's probably a ragdoll then, Awesome job, looks very interesting! Does it generate different people each time?


Quote: "What I would really like would be the ability to actually see the collision boxes, as we can with sprites. (or was this fixed? I really cant remember)"


Unfortunately this doesn't work indeed. I would LOVE to see the collision boxes as well, including for regular models / objects that are no physics objects, but can collide. Better yet, it would be nice if we could see the ray casting in a debug mode as well when checking for collisions ourselves. I've spend a greater part of a day just to find out using raycastsphere kept missing the object simply because the object it's Y position was like 1 unit too low. I kept thinking it was my coding (usually is ), but it was simply a matter of the raycast just missing the object.

basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 11th Oct 2018 11:34

Yeah, it's a ragdoll. It will be fairly easy (and fun!) to generate different people, but I need to get the basic figure done first. I would love to make a huge crowd, but I also fear that the physic simulation would end up being too heavy.

Regarding the broken Debug3DPhysicsWorld command, the page says "Note: This command does not currently work needs the ability to draw wireframe in AGK. "
I was thinking, Janbo has made a wireframe shader. Could there be a solution here?
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 11th Oct 2018 12:09
Hey what happened to SetObject3DPhysicsGroupAndMask()? Its gone from the help (which wasn't that helpful in the first place, but still...)
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 15th Oct 2018 23:22
Quote: "Regarding the broken Debug3DPhysicsWorld command, the page says "Note: This command does not currently work needs the ability to draw wireframe in AGK. "
I was thinking, Janbo has made a wireframe shader. Could there be a solution here?"


Well, yeah, I guess so. Unless the 3D mesh isn't the exact same as the collision box (for example, when having a chair that has (or should have) separately generated collision boxes for chair legs and such.

You are correct that using many physics objects requires some management of which objects are allowed to react. But it is not too complicated to code that. In one of my projects I used to check distance to player and then turn on physics for anything reasonably in range for collisions. Worked pretty well. Haven't tried a true 'stress test', but I do know the physics system doesn't like it when objects are spawned 'into' eachother.

Login to post a reply

Server time is: 2024-04-25 14:46:27
Your offset time is: 2024-04-25 14:46:27