Would you like to react to this message? Create an account in a few clicks or log in to continue.

Official Community Forums
 
HomeHome  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  The Wiki  Website  github Project  

 

 Placing objects (i.e. buildings) in-game

Go down 
5 posters
Go to page : Previous  1, 2, 3
AuthorMessage
Tristan
Administrator
Administrator
Tristan


Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyWed 18 Apr - 5:16

It works! Very Happy

Placing objects (i.e. buildings) in-game - Page 3 Object12

As you said, /createitem is the correct command. I did the Barrel and the Solar panel.

The only thing to work out now is how to give the model its collision volumes - any ideas?
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyWed 18 Apr - 5:24

Did you make the changes that were mentioned in the past week or so.
I put the wrong case on owner in MarsCursor.py it should be Owner that should do it
Back to top Go down
Tristan
Administrator
Administrator
Tristan


Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyWed 18 Apr - 5:38

Delurin wrote:
I updated the wiki to add the global variable heldObject = None to MarsCursor.py sorry I missed it.

I've added that to the top of the MarsCursor.py, yes. I haven't seen any changes in functionality - what's it supposed to do exactly?

Also, as the Solar Panel has a collision volume attached to it (when placed via World Editor, it works fine) - how do I get the collision volume to be placed with the solar panel when being added from the Inventory?
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyWed 18 Apr - 6:02

look through MarsCursor for owner and switch it to Owner it is different than what you quoted back to me
Back to top Go down
Tristan
Administrator
Administrator
Tristan


Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyWed 18 Apr - 7:19

Delurin wrote:
look through MarsCursor for owner and switch it to Owner it is different than what you quoted back to me

Ok, I did that but there was no change in the placement function.
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyWed 18 Apr - 7:27

Does the collision volume show up if you log out and log back in?
If it does not then you need to check and see if there is a physics file in the client assets (could just be on the world editor assets)
otherwise if it does appear then there is something wrong with the OnRightClick function so check if there are any error messages (if not try putting some log entries to make sure everything is being called)
Back to top Go down
RoH_James Proctor
Newbie
Newbie
RoH_James Proctor


Posts : 8
Join date : 2012-05-02
Location : Portland, Maine

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyWed 2 May - 17:00

Ok I went through the wiki article and I got it working perfectly... However Delurin is there way to get it so players can rotate the objects? I've spent a couple hours trying to work out a way to do it and it just keeps escaping me... Any help or insight you could provide would be great!

Here is an Area completely created in game by my character (The Buildings were added in game, The grass and path was added through the world editor):

Placing objects (i.e. buildings) in-game - Page 3 Screenshot00003
Back to top Go down
Tristan
Administrator
Administrator
Tristan


Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyThu 3 May - 1:06

I made the changes that you suggest in the chat last night, but I still can't get the at-mouse functionality to work....


Side-note: It seems that objects created by Player X have no collisions for that Player, however when I log in with Player Y, the objects created by Player X have full collisions. It seems that Players don't have collision on their own objects, if that makes sense.
Suggestions?
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyThu 3 May - 4:49

It sounds like there is a problem with your MarsCursor.py you want to send it to me and I will find the errors?

Also for the rotation you can make a command that handles rotation and then create buttons when you click on the object to call that function.


Code:
class RotateObjCommand (ProxyPlugin.CommandParser):
    def parse(self, cmdEvent):
   playerOid = cmdEvent.getObjectOid()
   targetOid = cmdEvent.getTarget()
        cmd = cmdEvent.getCommand()
   splitCmd = cmd.split(" ")
   objNode = WorldManagerClient.getWorldNode(targetOid)
   objOrient = objNode.getOrientation()
   newOrient = Quaternion.multiply(objOrient,Quaternion.fromAngleAxis(float(splitCmd[1]),MVVector(0,1,0)))
   objNode.setOrientation(newOrient)
   WorldManagerClient.updateWorldNode(targetOid,objNode)
   ObjectManagerClient.saveObject(targetOid)
proxyPlugin.registerCommand("/rotateObj", RotateObjCommand())



Basically if you click on an object and type /rotateObj float_radian
where float_radian is a float radian amount to rotate it will rotate it by that much around the y axis.
You can do a more involved version that would allow you to rotate in all directions but this should give you a good starting point.

Also you would put that in extensions_proxy.py or proxy.py


(The formatting got screwed up and so you will need to fix it)
Back to top Go down
RoH_James Proctor
Newbie
Newbie
RoH_James Proctor


Posts : 8
Join date : 2012-05-02
Location : Portland, Maine

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyThu 3 May - 5:12

How I was trying to do the rotation last night is by making a Command like you did. Then when the player is holding an object and presses the left mouse button moving the mouse left or right would rotate the object in that direction... any way to do it like that?
Back to top Go down
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyThu 3 May - 5:28

I havent tried doing that but it shouldnt be too difficult:
When you mouse down record the
Code:
mousePos = ClientAPI.GetMousePosition()
as a global then when you move the mouse see which way the mouse has moved (you could even do it by how much it has moved)


in the UpdateContextCursor check if the player is rotating the object then compare the current mouse position with the stored one
something like
Code:
newMP = ClientAPI.GetMousePosition()
   if newMp[0] > mousePos[0]:
     ClientAPI.Network.SendTargetedCommand(rotateObj.OID, "/rotateObj .1")
        else:
     ClientAPI.Network.SendTargetedCommand(rotateObj.OID, "/rotateObj -.1")


You would just need to specify somewhere that it is rotating the object and store the rotateObj object or at least the oid
Back to top Go down
RoH_James Proctor
Newbie
Newbie
RoH_James Proctor


Posts : 8
Join date : 2012-05-02
Location : Portland, Maine

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyThu 3 May - 8:50

Ok I got Rotation working however is there any way to bypass the activation of Mouselook? When your trying to rotate a Object MouseLook automatically comes on which is NOT the desired effect! lol I've looked up on the wiki and there doesn't seem to be a way to bypass it but maybe one of you know something about it that's not on the wiki!
Back to top Go down
RoH_James Proctor
Newbie
Newbie
RoH_James Proctor


Posts : 8
Join date : 2012-05-02
Location : Portland, Maine

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyThu 3 May - 10:11

Ok well while it's not the desired effect I do have the rotation working great! If you just hold down on the left Mouse button the Object will spin around until you let go of the left mouse button. Now if you have a really high FPS then it's possible it would spin around way to fast but at my current FPS it's working great!

I'll post a video at some point soon once I get more of the Demo Assets loaded in so more interesting areas can be created.
Back to top Go down
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 EmptyThu 3 May - 11:52

I dont believe there is a way to turn off mouse look from the python side of things...you could look into adding the functionality through c#.

One way you could get around it is to grab the player camera and turn it into a fixed point
Or you might be able to apply the WorldManagerClient.WORLD_PROP_NOTURN property to the player set it to 1 or True in extension_proxy when you click on the object and then turn it off when you are finished I do not remember if it stops the players camera from moving or only the player...
Back to top Go down
Sponsored content





Placing objects (i.e. buildings) in-game - Page 3 Empty
PostSubject: Re: Placing objects (i.e. buildings) in-game   Placing objects (i.e. buildings) in-game - Page 3 Empty

Back to top Go down
 
Placing objects (i.e. buildings) in-game
Back to top 
Page 3 of 3Go to page : Previous  1, 2, 3
 Similar topics
-
» Interactive Objects/Meshes
» Thinking about time and procedural objects...
» how to patch the game
» how to set XP (experience) in game.
» Game Business

Permissions in this forum:You cannot reply to topics in this forum
 :: Development :: Client Scripting and Development-
Jump to: