Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing physical state of object in Unity editor #637

Closed
skulkarni322 opened this issue Feb 24, 2021 · 3 comments
Closed

Changing physical state of object in Unity editor #637

skulkarni322 opened this issue Feb 24, 2021 · 3 comments

Comments

@skulkarni322
Copy link

I want to change the physical state of an object before placing it on my floorplan. For eg. I want to place a "broken bowl" in the room.
How can I change the state before placing it ?

@winthos
Copy link
Collaborator

winthos commented Feb 24, 2021

Check out the documentation for "object state changes" here: https://ai2thor.allenai.org/ithor/documentation/object-state-changes/#temporary-redirect

There is a temporary redirect on that page to the old documentation while we build the new page on the current site. All the information in the cached documentation is still the same and still works with the current release.

@skulkarni322
Copy link
Author

skulkarni322 commented Feb 25, 2021

from PIL import Image
from ai2thor.controller import Controller
c = Controller(scene='FloorPlan28')
event = c.step(action='MoveAhead', renderObjectImage=True)
meta = event.metadata['objects']
for i in range(len(meta)):
<>if meta[i]['objectType']== 'Mug':
<><>oid = meta[i]['objectId']
<><>event1 = c.step('BreakObject', objectId=oid)
<><>break

meta1 = event1.metadata['objects']
for i in range(len(meta1)):
<>if meta1[i]['objectId']==oid:
<><>print(meta1[i]['isBroken'])

My last print statement returns 'False' even though I've broken the Mug. Is there anything I'm doing wrong?
@winthos @mattdeitke

@mattdeitke
Copy link
Member

mattdeitke commented Feb 25, 2021

Try passing in forceAction=True. By default, objects are only interactable (i.e., with the default forceAction=False) if you are within 1.5 meters of it, and looking at it:

controller.step('BreakObject', objectId=oid, forceAction=True)

Here it is in Colab:
https://colab.research.google.com/drive/1bqgs7mz-6z6WTIsDqqdrr1JVe1C0sx-Q?usp=sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants